aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/BasicBlock.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2020-11-30 08:59:40 -0500
committerSanjay Patel <spatel@rotateright.com>2020-11-30 09:28:45 -0500
commitbfd2c216ea8ef09f8fb1f755ca2b89f86f74acbb (patch)
treed938facf6d2676ba620c924aa5e2c2e121a18b6d /llvm/lib/IR/BasicBlock.cpp
parent234a5297aa00648cba00347f24e9e9b99abde289 (diff)
downloadllvm-bfd2c216ea8ef09f8fb1f755ca2b89f86f74acbb.zip
llvm-bfd2c216ea8ef09f8fb1f755ca2b89f86f74acbb.tar.gz
llvm-bfd2c216ea8ef09f8fb1f755ca2b89f86f74acbb.tar.bz2
[IR][LoopRotate] avoid leaving phi with no operands (PR48296)
https://llvm.org/PR48296 shows an example where we delete all of the operands of a phi without actually deleting the phi, and that is currently considered invalid IR. The reduced test included here would crash for that reason. A suggested follow-up is to loosen the assert to allow 0-operand phis in unreachable blocks. Differential Revision: https://reviews.llvm.org/D92247
Diffstat (limited to 'llvm/lib/IR/BasicBlock.cpp')
-rw-r--r--llvm/lib/IR/BasicBlock.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 3268641..aee769a 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -330,7 +330,7 @@ void BasicBlock::removePredecessor(BasicBlock *Pred,
unsigned NumPreds = cast<PHINode>(front()).getNumIncomingValues();
for (PHINode &Phi : make_early_inc_range(phis())) {
- Phi.removeIncomingValue(Pred, !KeepOneInputPHIs);
+ Phi.removeIncomingValue(Pred);
if (KeepOneInputPHIs)
continue;
// If we have a single predecessor, removeIncomingValue erased the PHI