aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/BasicBlock.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2020-05-19 12:30:26 +0100
committerJay Foad <jay.foad@amd.com>2020-05-19 13:17:11 +0100
commitc1ae72d03f71bb0a4cf7c39ce5ffe3dbc8b96514 (patch)
tree8970587c110c1e5ba691a7df2f16b62446b65cd4 /llvm/lib/IR/BasicBlock.cpp
parent6e99199419d95f39ae9d8a11d8632caac7b405b4 (diff)
downloadllvm-c1ae72d03f71bb0a4cf7c39ce5ffe3dbc8b96514.zip
llvm-c1ae72d03f71bb0a4cf7c39ce5ffe3dbc8b96514.tar.gz
llvm-c1ae72d03f71bb0a4cf7c39ce5ffe3dbc8b96514.tar.bz2
[IR] Revert r119493
r119493 protected against PHINode::hasConstantValue returning the PHI node itself, but a later fix in r159687 means that can never happen, so the workarounds are no longer required.
Diffstat (limited to 'llvm/lib/IR/BasicBlock.cpp')
-rw-r--r--llvm/lib/IR/BasicBlock.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 4baf368..a9fa7cae 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -368,11 +368,10 @@ void BasicBlock::removePredecessor(BasicBlock *Pred,
// If all incoming values to the Phi are the same, we can replace the Phi
// with that value.
Value* PNV = nullptr;
- if (!KeepOneInputPHIs && (PNV = PN->hasConstantValue()))
- if (PNV != PN) {
- PN->replaceAllUsesWith(PNV);
- PN->eraseFromParent();
- }
+ if (!KeepOneInputPHIs && (PNV = PN->hasConstantValue())) {
+ PN->replaceAllUsesWith(PNV);
+ PN->eraseFromParent();
+ }
}
}
}