[llvm] 0ab2061 - [WebAssembly] Represent trap instructions as `poison` (#134553)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 06:29:59 PDT 2025


Author: Pedro Lobo
Date: 2025-04-07T14:29:55+01:00
New Revision: 0ab2061c4fd0feac8b142ff76ed823534bebc634

URL: https://github.com/llvm/llvm-project/commit/0ab2061c4fd0feac8b142ff76ed823534bebc634
DIFF: https://github.com/llvm/llvm-project/commit/0ab2061c4fd0feac8b142ff76ed823534bebc634.diff

LOG: [WebAssembly] Represent trap instructions as `poison` (#134553)

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

Added: 
    

Modified: 
    llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp

Removed: 
    


################################################################################
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);


        


More information about the llvm-commits mailing list