Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebAssembly] Represent trap instructions as poison #134553

Merged
merged 1 commit into from
Apr 7, 2025

Conversation

pedroclobo
Copy link
Member

The WebAssemblyLowerRefTypesIntPtrConv pass currently uses undef to represent trap instructions. These can instead be represented by the poison value.

The WebAssemblyLowerRefTypesIntPtrConv pass currently uses `undef` to
represent trap instructions. These can instead be represented by the
`poison` value.
@llvmbot
Copy link
Member

llvmbot commented Apr 6, 2025

@llvm/pr-subscribers-backend-webassembly

Author: Pedro Lobo (pedroclobo)

Changes

The WebAssemblyLowerRefTypesIntPtrConv pass currently uses undef to represent trap instructions. These can instead be represented by the poison value.


Full diff: https://github.com/llvm/llvm-project/pull/134553.diff

1 Files Affected:

  • (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp (+1-2)
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp
index c61aa5eff4a70..be500de67e320 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp
@@ -68,8 +68,7 @@ bool WebAssemblyLowerRefTypesIntPtrConv::runOnFunction(Function &F) {
         !(ITP && WebAssembly::isWebAssemblyReferenceType(ITP->getDestTy())))
       continue;
 
-    UndefValue *U = UndefValue::get(I->getType());
-    I->replaceAllUsesWith(U);
+    I->replaceAllUsesWith(PoisonValue::get(I->getType()));
 
     Function *TrapIntrin =
         Intrinsic::getOrInsertDeclaration(F.getParent(), Intrinsic::debugtrap);

@pedroclobo pedroclobo merged commit 0ab2061 into llvm:main Apr 7, 2025
13 checks passed
@pedroclobo pedroclobo deleted the wasm-poison-intptr branch April 7, 2025 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants