forked from OSchip/llvm-project
[ConstantHoisting] Support opaque pointers
Directly use i8 for GEP, rather than fetching element type of i8*.
This commit is contained in:
parent
b4e88d4db1
commit
3e54de4df2
|
@ -762,7 +762,7 @@ void ConstantHoistingPass::emitBaseConstants(Instruction *Base,
|
|||
PointerType *Int8PtrTy = Type::getInt8PtrTy(*Ctx,
|
||||
cast<PointerType>(Ty)->getAddressSpace());
|
||||
Base = new BitCastInst(Base, Int8PtrTy, "base_bitcast", InsertionPt);
|
||||
Mat = GetElementPtrInst::Create(Int8PtrTy->getElementType(), Base,
|
||||
Mat = GetElementPtrInst::Create(Type::getInt8Ty(*Ctx), Base,
|
||||
Offset, "mat_gep", InsertionPt);
|
||||
Mat = new BitCastInst(Mat, Ty, "mat_bitcast", InsertionPt);
|
||||
} else
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
; RUN: llc -mtriple=aarch64-none-unknown-linuxeabi -consthoist-gep %s -o - | FileCheck %s
|
||||
; RUN: llc -mtriple=aarch64-none-unknown-linuxeabi -consthoist-gep -force-opaque-pointers %s -o - | FileCheck %s
|
||||
|
||||
; CHECK-NOT: adrp x10, global+332
|
||||
; CHECK-NOT: add x10, x10, :lo12:global+332
|
||||
|
|
Loading…
Reference in New Issue