diff options
author | Duncan Sands <baldrick@free.fr> | 2007-07-06 09:10:03 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2007-07-06 09:10:03 +0000 |
commit | b4fd45e2fc4973214227fbaa96975d9fcc19ba42 (patch) | |
tree | 71dcc3d9effff975207e2a281c295c5982f8c1c6 | |
parent | 33b0b8d242de8d428f11e77ea734a08b47797216 (diff) |
Remove ExtractGlobalVariable - use StripPointerCasts
instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37937 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index e9a9b49af1..2710560aa9 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2491,27 +2491,10 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I, } } -/// ExtractGlobalVariable - If V is a global variable, or a bitcast of one -/// (possibly constant folded), return it. Otherwise return NULL. -static GlobalVariable *ExtractGlobalVariable (Value *V) { - if (GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) - return GV; - else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) { - if (CE->getOpcode() == Instruction::BitCast) - return dyn_cast<GlobalVariable>(CE->getOperand(0)); - else if (CE->getOpcode() == Instruction::GetElementPtr) { - for (unsigned i = 1, e = CE->getNumOperands(); i != e; ++i) - if (!CE->getOperand(i)->isNullValue()) - return NULL; - return dyn_cast<GlobalVariable>(CE->getOperand(0)); - } - } - return NULL; -} - -/// ExtractTypeInfo - Extracts the type info from a value. +/// ExtractTypeInfo - Returns the type info, possibly bitcast, encoded in V. static GlobalVariable *ExtractTypeInfo (Value *V) { - GlobalVariable *GV = ExtractGlobalVariable(V); + V = IntrinsicInst::StripPointerCasts(V); + GlobalVariable *GV = dyn_cast<GlobalVariable>(V); assert (GV || isa<ConstantPointerNull>(V) && "TypeInfo must be a global variable or NULL"); return GV; |