diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/ConstantHoisting.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/ConstantHoisting.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp index 611e64bd0976..3e5d979f11cc 100644 --- a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp +++ b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp @@ -761,11 +761,9 @@ void ConstantHoistingPass::emitBaseConstants(Instruction *Base, if (Adj->Offset) { if (Adj->Ty) { // Constant being rebased is a ConstantExpr. - PointerType *Int8PtrTy = Type::getInt8PtrTy( - *Ctx, cast<PointerType>(Adj->Ty)->getAddressSpace()); - Base = new BitCastInst(Base, Int8PtrTy, "base_bitcast", Adj->MatInsertPt); Mat = GetElementPtrInst::Create(Type::getInt8Ty(*Ctx), Base, Adj->Offset, "mat_gep", Adj->MatInsertPt); + // Hide it behind a bitcast. Mat = new BitCastInst(Mat, Adj->Ty, "mat_bitcast", Adj->MatInsertPt); } else // Constant being rebased is a ConstantInt. |
