[llvm] e20f0fe - [WasmEHPrepare] Explicitly create inbounds GEP (NFCI)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 07:13:45 PDT 2024
Author: Nikita Popov
Date: 2024-05-29T16:13:36+02:00
New Revision: e20f0fe29f714a22679214b499744735d528fc1a
URL: https://github.com/llvm/llvm-project/commit/e20f0fe29f714a22679214b499744735d528fc1a
DIFF: https://github.com/llvm/llvm-project/commit/e20f0fe29f714a22679214b499744735d528fc1a.diff
LOG: [WasmEHPrepare] Explicitly create inbounds GEP (NFCI)
These are known to be inbounds, create them as such. NFCI because
constant expression construction currently already infers this.
Also drop the unnecessary zero-index GEP: This is equivalent to
the pointer itself nowadays.
Added:
Modified:
llvm/lib/CodeGen/WasmEHPrepare.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/WasmEHPrepare.cpp b/llvm/lib/CodeGen/WasmEHPrepare.cpp
index 1a9e1ba869c31..16c1dcb1e1175 100644
--- a/llvm/lib/CodeGen/WasmEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WasmEHPrepare.cpp
@@ -252,12 +252,11 @@ bool WasmEHPrepareImpl::prepareEHPads(Function &F) {
M.getOrInsertGlobal("__wasm_lpad_context", LPadContextTy));
LPadContextGV->setThreadLocalMode(GlobalValue::GeneralDynamicTLSModel);
- LPadIndexField = IRB.CreateConstGEP2_32(LPadContextTy, LPadContextGV, 0, 0,
- "lpad_index_gep");
- LSDAField =
- IRB.CreateConstGEP2_32(LPadContextTy, LPadContextGV, 0, 1, "lsda_gep");
- SelectorField = IRB.CreateConstGEP2_32(LPadContextTy, LPadContextGV, 0, 2,
- "selector_gep");
+ LPadIndexField = LPadContextGV;
+ LSDAField = IRB.CreateConstInBoundsGEP2_32(LPadContextTy, LPadContextGV, 0, 1,
+ "lsda_gep");
+ SelectorField = IRB.CreateConstInBoundsGEP2_32(LPadContextTy, LPadContextGV,
+ 0, 2, "selector_gep");
// wasm.landingpad.index() intrinsic, which is to specify landingpad index
LPadIndexF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_landingpad_index);
More information about the llvm-commits
mailing list