Skip to content

Conversation

@pedroclobo
Copy link
Member

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

@llvmbot
Copy link
Member

llvmbot commented Dec 8, 2024

@llvm/pr-subscribers-llvm-transforms

Author: Pedro Lobo (pedroclobo)

Changes

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

Create dummy phi nodes with a `poison` operand instead of `undef`.
@pedroclobo pedroclobo changed the title [StructurizeCFG] Use poison instead of undef as placeholder [StructurizeCFG] Use poison instead of undef as placeholder Dec 8, 2024
@pedroclobo
Copy link
Member Author

cc @nunoplopes

@nunoplopes nunoplopes merged commit 9865296 into llvm:main Dec 10, 2024
8 checks passed
@pedroclobo pedroclobo deleted the cfg-poison branch December 18, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants