1. Fix a REALLY nasty cyclic replacement issue that Anshu discovered, causing
nondeterminstic crashes and memory corruption.
2. For performance, don't go inserting constantexpr casts of GV pointers.
This should definitely go into 1.3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15568
91177308-0d34-0410-b5e6-
96231b3b80d8
// If it's a constant... all constants can be converted to a different
// type.
//
- if (Constant *CPV = dyn_cast<Constant>(V))
+ if (isa<Constant>(V) && !isa<GlobalValue>(V))
return true;
CTMap[V] = Ty;
unsigned OtherIdx = (OldVal == I->getOperand(0)) ? 1 : 0;
Value *OtherOp = I->getOperand(OtherIdx);
+ Res->setOperand(!OtherIdx, NewVal);
Value *NewOther = ConvertExpressionToType(OtherOp, NewTy, VMC, TD);
-
Res->setOperand(OtherIdx, NewOther);
- Res->setOperand(!OtherIdx, NewVal);
break;
}
case Instruction::Shl: