[PATCH] D80128: [IR] Revert r2694 in BasicBlock::removePredecessor
Jay Foad via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 18 11:21:55 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbdd8c111fc0d: [IR] Revert r2694 in BasicBlock::removePredecessor (authored by foad).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80128/new/
https://reviews.llvm.org/D80128
Files:
llvm/lib/IR/BasicBlock.cpp
Index: llvm/lib/IR/BasicBlock.cpp
===================================================================
--- llvm/lib/IR/BasicBlock.cpp
+++ llvm/lib/IR/BasicBlock.cpp
@@ -334,25 +334,9 @@
if (!APN) return; // Quick exit.
// If there are exactly two predecessors, then we want to nuke the PHI nodes
- // altogether. However, we cannot do this, if this in this case:
- //
- // Loop:
- // %x = phi [X, Loop]
- // %x2 = add %x, 1 ;; This would become %x2 = add %x2, 1
- // br Loop ;; %x2 does not dominate all uses
- //
- // This is because the PHI node input is actually taken from the predecessor
- // basic block. The only case this can happen is with a self loop, so we
- // check for this case explicitly now.
- //
+ // altogether.
unsigned max_idx = APN->getNumIncomingValues();
assert(max_idx != 0 && "PHI Node in block with 0 predecessors!?!?!");
- if (max_idx == 2) {
- BasicBlock *Other = APN->getIncomingBlock(APN->getIncomingBlock(0) == Pred);
-
- // Disable PHI elimination!
- if (this == Other) max_idx = 3;
- }
// <= Two predecessors BEFORE I remove one?
if (max_idx <= 2 && !KeepOneInputPHIs) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80128.264686.patch
Type: text/x-patch
Size: 1187 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200518/e7c33a3e/attachment.bin>
More information about the llvm-commits
mailing list