From 784fe9dbbbb51e7bfe03313f84d80411700ab05c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 27 Apr 2007 01:20:11 +0000 Subject: [PATCH] improve EH global handling, patch by Duncan Sands. llvm-svn: 36499 --- .../CodeGen/SelectionDAG/SelectionDAGISel.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index db9bf0d0df12..ac3eedfa3a17 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2610,14 +2610,18 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) { // MachineModuleInfo. std::vector TyInfo; for (unsigned i = 3, N = I.getNumOperands(); i < N; ++i) { - ConstantExpr *CE = dyn_cast(I.getOperand(i)); - if (CE && CE->getOpcode() == Instruction::BitCast && - isa(CE->getOperand(0))) { + Constant *C = cast(I.getOperand(i)); + if (GlobalVariable *GV = dyn_cast(C)) { + TyInfo.push_back(GV); + } else if (ConstantExpr *CE = dyn_cast(C)) { + assert(CE->getOpcode() == Instruction::BitCast && + isa(CE->getOperand(0)) + && "TypeInfo must be a global variable or NULL"); TyInfo.push_back(cast(CE->getOperand(0))); } else { - ConstantInt *CI = dyn_cast(I.getOperand(i)); - assert(CI && CI->getZExtValue() == 0 && - "TypeInfo must be a global variable typeinfo or NULL"); + ConstantInt *CI = dyn_cast(C); + assert(CI && CI->isNullValue() && + "TypeInfo must be a global variable or NULL"); TyInfo.push_back(NULL); } }