// the preheader, instead of being forward substituted into the uses. We
// do this by forcing a BitCast (noop cast) to be inserted into the
// preheader in this case.
- if (!fitsInAddressMode(Base, getAccessType(Inst), TLI, false)) {
+ if (!fitsInAddressMode(Base, getAccessType(Inst), TLI, false) &&
+ !isa<Instruction>(BaseV)) {
// We want this constant emitted into the preheader! This is just
// using cast as a copy so BitCast (no-op cast) is appropriate
BaseV = new BitCastInst(BaseV, BaseV->getType(), "preheaderinsert",