Expand the coercion of constants to include the newly constant Globals.
llvm-svn: 14966
diff --git a/llvm/lib/Transforms/Scalar/LowerGC.cpp b/llvm/lib/Transforms/Scalar/LowerGC.cpp
index ce67d0e..0c03b91 100644
--- a/llvm/lib/Transforms/Scalar/LowerGC.cpp
+++ b/llvm/lib/Transforms/Scalar/LowerGC.cpp
@@ -140,8 +140,7 @@
/// 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);