[llvm] 3e54de4 - [ConstantHoisting] Support opaque pointers
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 8 12:23:18 PDT 2021
Author: Nikita Popov
Date: 2021-09-08T21:23:10+02:00
New Revision: 3e54de4df232f1cfc9570ea7958abee8d04f7b0b
URL: https://github.com/llvm/llvm-project/commit/3e54de4df232f1cfc9570ea7958abee8d04f7b0b
DIFF: https://github.com/llvm/llvm-project/commit/3e54de4df232f1cfc9570ea7958abee8d04f7b0b.diff
LOG: [ConstantHoisting] Support opaque pointers
Directly use i8 for GEP, rather than fetching element type of i8*.
Added:
Modified:
llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
llvm/test/CodeGen/AArch64/consthoist-gep.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
index 535f50d4f904..0bf045e26e37 100644
--- a/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
+++ b/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -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
diff --git a/llvm/test/CodeGen/AArch64/consthoist-gep.ll b/llvm/test/CodeGen/AArch64/consthoist-gep.ll
index 507f949b6ad7..00e31ad2ea2c 100644
--- a/llvm/test/CodeGen/AArch64/consthoist-gep.ll
+++ b/llvm/test/CodeGen/AArch64/consthoist-gep.ll
@@ -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
More information about the llvm-commits
mailing list