Skip to content

Commit e20f0fe

Browse files
committed
[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.
1 parent e8e5ba0 commit e20f0fe

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/CodeGen/WasmEHPrepare.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,11 @@ bool WasmEHPrepareImpl::prepareEHPads(Function &F) {
252252
M.getOrInsertGlobal("__wasm_lpad_context", LPadContextTy));
253253
LPadContextGV->setThreadLocalMode(GlobalValue::GeneralDynamicTLSModel);
254254

255-
LPadIndexField = IRB.CreateConstGEP2_32(LPadContextTy, LPadContextGV, 0, 0,
256-
"lpad_index_gep");
257-
LSDAField =
258-
IRB.CreateConstGEP2_32(LPadContextTy, LPadContextGV, 0, 1, "lsda_gep");
259-
SelectorField = IRB.CreateConstGEP2_32(LPadContextTy, LPadContextGV, 0, 2,
260-
"selector_gep");
255+
LPadIndexField = LPadContextGV;
256+
LSDAField = IRB.CreateConstInBoundsGEP2_32(LPadContextTy, LPadContextGV, 0, 1,
257+
"lsda_gep");
258+
SelectorField = IRB.CreateConstInBoundsGEP2_32(LPadContextTy, LPadContextGV,
259+
0, 2, "selector_gep");
261260

262261
// wasm.landingpad.index() intrinsic, which is to specify landingpad index
263262
LPadIndexF = Intrinsic::getDeclaration(&M, Intrinsic::wasm_landingpad_index);

0 commit comments

Comments
 (0)