Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[StructurizeCFG] Use poison instead of undef as placeholder #119137

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

pedroclobo
Copy link
Contributor

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
Contributor Author

cc @nunoplopes

@nunoplopes nunoplopes merged commit 9865296 into llvm:main Dec 10, 2024
8 checks passed
broxigarchen pushed a commit to broxigarchen/llvm-project that referenced this pull request Dec 10, 2024
@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