[llvm] [WebAssembly] Change placeholder from `undef` to `poison` (PR #131536)

via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 16 12:04:53 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-webassembly

Author: Pedro Lobo (pedroclobo)

<details>
<summary>Changes</summary>

Use `poison` instead of `undef` as a placeholder for phi entries of unreachable predecessors.

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


1 Files Affected:

- (modified) llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (+2-2) 


``````````diff
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
index 2d11019291a7a..0e79a13d4ccaa 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp
@@ -1767,7 +1767,7 @@ void WebAssemblyLowerEmscriptenEHSjLj::handleLongjmpableCallsForWasmSjLj(
     I->eraseFromParent();
 
   // Add entries for new predecessors to phis in unwind destinations. We use
-  // 'undef' as a placeholder value. We should make sure the phis have a valid
+  // 'poison' as a placeholder value. We should make sure the phis have a valid
   // set of predecessors before running SSAUpdater, because SSAUpdater
   // internally can use existing phis to gather predecessor info rather than
   // scanning the actual CFG (See FindPredecessorBlocks in SSAUpdater.cpp for
@@ -1776,7 +1776,7 @@ void WebAssemblyLowerEmscriptenEHSjLj::handleLongjmpableCallsForWasmSjLj(
     for (PHINode &PN : UnwindDest->phis()) {
       for (auto *NewPred : NewPreds) {
         assert(PN.getBasicBlockIndex(NewPred) == -1);
-        PN.addIncoming(UndefValue::get(PN.getType()), NewPred);
+        PN.addIncoming(PoisonValue::get(PN.getType()), NewPred);
       }
     }
   }

``````````

</details>


https://github.com/llvm/llvm-project/pull/131536


More information about the llvm-commits mailing list