Expand the coercion of constants to include the newly constant Globals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14966 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2004-07-18 08:34:19 +00:00
parent 5f0eb64079
commit c3c2fdf5a8

View 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);