[llvm] [StructurizeCFG] Use `poison` instead of `undef `as placeholder (PR #119137)

via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 8 10:09:19 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Pedro Lobo (pedroclobo)

<details>
<summary>Changes</summary>

Create dummy phi nodes with a `poison` operand instead of `undef`.

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


1 Files Affected:

- (modified) llvm/lib/Transforms/Scalar/StructurizeCFG.cpp (+2-2) 


``````````diff
diff --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
index 01090b54e5afa3..b1f742b838f2a1 100644
--- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -686,8 +686,8 @@ void StructurizeCFG::delPhiValues(BasicBlock *From, BasicBlock *To) {
 /// Add a dummy PHI value as soon as we knew the new predecessor
 void StructurizeCFG::addPhiValues(BasicBlock *From, BasicBlock *To) {
   for (PHINode &Phi : To->phis()) {
-    Value *Undef = UndefValue::get(Phi.getType());
-    Phi.addIncoming(Undef, From);
+    Value *Poison = PoisonValue::get(Phi.getType());
+    Phi.addIncoming(Poison, From);
   }
   AddedPhis[To].push_back(From);
 }

``````````

</details>


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


More information about the llvm-commits mailing list