1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[LoopSimplifyCFG] Do not count dead exit blocks twice, make CFG simpler

llvm-svn: 353276
This commit is contained in:
Max Kazantsev 2019-02-06 07:49:17 +00:00
parent 76e7af4002
commit 126ecfaee6
2 changed files with 3 additions and 3 deletions

View File

@ -229,8 +229,10 @@ private:
// Now, all exit blocks that are not marked as live are dead.
SmallVector<BasicBlock *, 8> ExitBlocks;
L.getExitBlocks(ExitBlocks);
SmallPtrSet<BasicBlock *, 8> UniqueDeadExits;
for (auto *ExitBlock : ExitBlocks)
if (!LiveExitBlocks.count(ExitBlock))
if (!LiveExitBlocks.count(ExitBlock) &&
UniqueDeadExits.insert(ExitBlock).second)
DeadExitBlocks.push_back(ExitBlock);
// Whether or not the edge From->To will still be present in graph after the

View File

@ -288,8 +288,6 @@ define i32 @dead_exit_test_switch_loop(i32 %end) {
; CHECK-NEXT: preheader:
; CHECK-NEXT: switch i32 0, label [[PREHEADER_SPLIT:%.*]] [
; CHECK-NEXT: i32 1, label [[DEAD:%.*]]
; CHECK-NEXT: i32 2, label [[DEAD]]
; CHECK-NEXT: i32 3, label [[DEAD]]
; CHECK-NEXT: ]
; CHECK: preheader-split:
; CHECK-NEXT: br label [[HEADER:%.*]]