[llvm] [WebAssembly] Represent trap instructions as `poison` (PR #134553)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 6 10:35:38 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-webassembly
Author: Pedro Lobo (pedroclobo)
<details>
<summary>Changes</summary>
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
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);
``````````
</details>
https://github.com/llvm/llvm-project/pull/134553
More information about the llvm-commits
mailing list