Skip to content

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