[llvm-commits] [llvm] r37937 - /llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Duncan Sands baldrick at free.fr
Fri Jul 6 02:10:03 PDT 2007


Author: baldrick
Date: Fri Jul  6 04:10:03 2007
New Revision: 37937

URL: http://llvm.org/viewvc/llvm-project?rev=37937&view=rev
Log:
Remove ExtractGlobalVariable - use StripPointerCasts
instead.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=37937&r1=37936&r2=37937&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Jul  6 04:10:03 2007
@@ -2491,27 +2491,10 @@
   }
 }
 
-/// 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;





More information about the llvm-commits mailing list