[llvm] 7ffeb8e - PromoteMem2Reg: use poison instead of undef as placeholder in phi entries from unreachable predecessors [NFC]
Nuno Lopes via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 10 03:19:49 PDT 2023
Author: Nuno Lopes
Date: 2023-06-10T11:19:03+01:00
New Revision: 7ffeb8efe8a08d74649c325a7eb70dc0b853326e
URL: https://github.com/llvm/llvm-project/commit/7ffeb8efe8a08d74649c325a7eb70dc0b853326e
DIFF: https://github.com/llvm/llvm-project/commit/7ffeb8efe8a08d74649c325a7eb70dc0b853326e.diff
LOG: PromoteMem2Reg: use poison instead of undef as placeholder in phi entries from unreachable predecessors [NFC]
Added:
Modified:
llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
llvm/test/Transforms/Mem2Reg/undef-order.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 3b321cdb699b5..2e5f40d39912d 100644
--- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -835,7 +835,7 @@ void PromoteMem2Reg::run() {
// code. Unfortunately, there may be unreachable blocks which the renamer
// hasn't traversed. If this is the case, the PHI nodes may not
// have incoming values for all predecessors. Loop over all PHI nodes we have
- // created, inserting undef values if they are missing any incoming values.
+ // created, inserting poison values if they are missing any incoming values.
for (DenseMap<std::pair<unsigned, unsigned>, PHINode *>::iterator
I = NewPhiNodes.begin(),
E = NewPhiNodes.end();
@@ -885,9 +885,9 @@ void PromoteMem2Reg::run() {
BasicBlock::iterator BBI = BB->begin();
while ((SomePHI = dyn_cast<PHINode>(BBI++)) &&
SomePHI->getNumIncomingValues() == NumBadPreds) {
- Value *UndefVal = UndefValue::get(SomePHI->getType());
+ Value *PoisonVal = PoisonValue::get(SomePHI->getType());
for (BasicBlock *Pred : Preds)
- SomePHI->addIncoming(UndefVal, Pred);
+ SomePHI->addIncoming(PoisonVal, Pred);
}
}
diff --git a/llvm/test/Transforms/Mem2Reg/undef-order.ll b/llvm/test/Transforms/Mem2Reg/undef-order.ll
index 59490e7314204..510a5282ece8e 100644
--- a/llvm/test/Transforms/Mem2Reg/undef-order.ll
+++ b/llvm/test/Transforms/Mem2Reg/undef-order.ll
@@ -45,7 +45,7 @@ define i32 @foo() {
; CHECK: Block16:
; CHECK-NEXT: br label [[JOIN]]
; CHECK: Join:
-; CHECK-NEXT: [[VAL_0:%.*]] = phi i32 [ 1, [[STORE1]] ], [ 2, [[STORE2]] ], [ undef, [[BLOCK1:%.*]] ], [ undef, [[BLOCK2:%.*]] ], [ undef, [[BLOCK3:%.*]] ], [ undef, [[BLOCK4:%.*]] ], [ undef, [[BLOCK5:%.*]] ], [ undef, [[BLOCK6:%.*]] ], [ undef, [[BLOCK7:%.*]] ], [ undef, [[BLOCK8:%.*]] ], [ undef, [[BLOCK9:%.*]] ], [ undef, [[BLOCK10:%.*]] ], [ undef, [[BLOCK11:%.*]] ], [ undef, [[BLOCK12:%.*]] ], [ undef, [[BLOCK13:%.*]] ], [ undef, [[BLOCK14:%.*]] ], [ undef, [[BLOCK15:%.*]] ], [ undef, [[BLOCK16:%.*]] ]
+; CHECK-NEXT: [[VAL_0:%.*]] = phi i32 [ 1, [[STORE1]] ], [ 2, [[STORE2]] ], [ poison, [[BLOCK1:%.*]] ], [ poison, [[BLOCK2:%.*]] ], [ poison, [[BLOCK3:%.*]] ], [ poison, [[BLOCK4:%.*]] ], [ poison, [[BLOCK5:%.*]] ], [ poison, [[BLOCK6:%.*]] ], [ poison, [[BLOCK7:%.*]] ], [ poison, [[BLOCK8:%.*]] ], [ poison, [[BLOCK9:%.*]] ], [ poison, [[BLOCK10:%.*]] ], [ poison, [[BLOCK11:%.*]] ], [ poison, [[BLOCK12:%.*]] ], [ poison, [[BLOCK13:%.*]] ], [ poison, [[BLOCK14:%.*]] ], [ poison, [[BLOCK15:%.*]] ], [ poison, [[BLOCK16:%.*]] ]
; CHECK-NEXT: ret i32 [[VAL_0]]
;
Entry:
More information about the llvm-commits
mailing list