summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2018-04-23 06:58:36 +0000
committerChandler Carruth <chandlerc@gmail.com>2018-04-23 06:58:36 +0000
commitbf7190a15470adb31f8df08aa9d61bb2861e7d54 (patch)
tree0d0bfd116ce1746ca7591b59b880db5464d51059 /llvm/lib/Transforms
parent3f1d53816549f4073f73f8cedc36665b1f70df40 (diff)
downloadbcm5719-llvm-bf7190a15470adb31f8df08aa9d61bb2861e7d54.tar.gz
bcm5719-llvm-bf7190a15470adb31f8df08aa9d61bb2861e7d54.zip
[PM/LoopUnswitch] Remove a buggy assert in the new loop unswitch.
The condition this was asserting doesn't actually hold. I've added comments to explain why, removed the assert, and added a fun test case reduced out of 403.gcc. llvm-svn: 330564
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
index b6194d96cdf..c7b071b36b5 100644
--- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -1364,9 +1364,10 @@ static SmallPtrSet<const BasicBlock *, 16> recomputeLoopBlockSet(Loop &L,
continue;
// Insert all of the blocks (other than those already present) into
- // the loop set. The only block we expect to already be in the set is
- // the one we used to find this loop as we immediately handle the
- // others the first time we encounter the loop.
+ // the loop set. We expect at least the block that led us to find the
+ // inner loop to be in the block set, but we may also have other loop
+ // blocks if they were already enqueued as predecessors of some other
+ // outer loop block.
for (auto *InnerBB : InnerL->blocks()) {
if (InnerBB == BB) {
assert(LoopBlockSet.count(InnerBB) &&
@@ -1374,9 +1375,7 @@ static SmallPtrSet<const BasicBlock *, 16> recomputeLoopBlockSet(Loop &L,
continue;
}
- bool Inserted = LoopBlockSet.insert(InnerBB).second;
- (void)Inserted;
- assert(Inserted && "Should only insert an inner loop once!");
+ LoopBlockSet.insert(InnerBB);
}
// Add the preheader to the worklist so we will continue past the
OpenPOWER on IntegriCloud