[llvm] [StructurizeCFG] Use `poison` instead of `undef `as placeholder (PR #119137)
Pedro Lobo via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 8 10:08:49 PST 2024
https://github.com/pedroclobo created https://github.com/llvm/llvm-project/pull/119137
Create dummy phi nodes with a `poison` operand instead of `undef`.
>From 2f56e2342fa04ab019c6cce72c07ca4fd15e6a5f Mon Sep 17 00:00:00 2001
From: Pedro Lobo <pedro.lobo at tecnico.ulisboa.pt>
Date: Sun, 8 Dec 2024 17:56:28 +0000
Subject: [PATCH] [StructurizeCFG] Use `poison` instead of `undef `as
placeholder
Create dummy phi nodes with a `poison` operand instead of `undef`.
---
llvm/lib/Transforms/Scalar/StructurizeCFG.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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);
}
More information about the llvm-commits
mailing list