Expand the coercion of constants to include the newly constant Globals.
authorReid Spencer <rspencer@reidspencer.com>
Sun, 18 Jul 2004 08:34:19 +0000 (08:34 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sun, 18 Jul 2004 08:34:19 +0000 (08:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14966 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LowerGC.cpp

index ce67d0e7a177395244b3279ca01c5003b87cb57d..0c03b91d55e0d21af36d38f7e3cffeff1de15ac1 100644 (file)
@@ -140,8 +140,7 @@ bool LowerGC::doInitialization(Module &M) {
 /// not have the specified type, insert a cast.
 static void Coerce(Instruction *I, unsigned OpNum, Type *Ty) {
   if (I->getOperand(OpNum)->getType() != Ty) {
-    Constant *C = dyn_cast<Constant>(I->getOperand(OpNum));
-    if (C && !isa<GlobalValue>(I->getOperand(OpNum)))
+    if (Constant *C = dyn_cast<Constant>(I->getOperand(OpNum))) 
       I->setOperand(OpNum, ConstantExpr::getCast(C, Ty));
     else {
       CastInst *C = new CastInst(I->getOperand(OpNum), Ty, "", I);