How about this instead?

Duncan.
Index: llvm.master/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
===================================================================
--- llvm.master.orig/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	2007-04-14 17:37:08.000000000 +0200
+++ llvm.master/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	2007-04-14 19:25:31.000000000 +0200
@@ -2604,14 +2604,19 @@
       // MachineModuleInfo.
       std::vector<GlobalVariable *> TyInfo;
       for (unsigned i = 3, N = I.getNumOperands(); i < N; ++i) {
-        ConstantExpr *CE = dyn_cast<ConstantExpr>(I.getOperand(i));
-        if (CE && CE->getOpcode() == Instruction::BitCast &&
-            isa<GlobalVariable>(CE->getOperand(0))) {
+        Constant *C = cast<Constant>(I.getOperand(i));
+        if (isa<GlobalVariable>(C)) {
+          TyInfo.push_back(cast<GlobalVariable>(C));
+        } else if (isa<ConstantExpr>(C)) {
+          ConstantExpr *CE = cast<ConstantExpr>(C);
+          assert(CE->getOpcode() == Instruction::BitCast &&
+                 isa<GlobalVariable>(CE->getOperand(0))
+                 && "TypeInfo must be a global variable or NULL");
           TyInfo.push_back(cast<GlobalVariable>(CE->getOperand(0)));
         } else {
-          ConstantInt *CI = dyn_cast<ConstantInt>(I.getOperand(i));
-          assert(CI && CI->getZExtValue() == 0 &&
-            "TypeInfo must be a global variable typeinfo or NULL");
+          ConstantInt *CI = dyn_cast<ConstantInt>(C);
+          assert(CI && CI->isNullValue() &&
+                 "TypeInfo must be a global variable or NULL");
           TyInfo.push_back(NULL);
         }
       }
_______________________________________________
llvm-commits mailing list
[EMAIL PROTECTED]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to