[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.
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp
index c61aa5e..be500de 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerRefTypesIntPtrConv.cpp
@@ -68,8 +68,7 @@
!(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);