forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CycleInfo] skip unreachable predecessors (llvm#101316)
If an unreachable block B branches to a block S inside a cycle, it may cause S to be incorrectly treated as an entry to the cycle. We avoid that by skipping unreachable predecessors when locating entries.
- Loading branch information
1 parent
576060b
commit b584ca4
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
; RUN: opt < %s -disable-output -passes='print<cycles>' 2>&1 | FileCheck %s | ||
; CHECK-LABEL: CycleInfo for function: unreachable | ||
; CHECK: depth=1: entries(loop.body) loop.latch inner.block | ||
define void @unreachable(i32 %n) { | ||
entry: | ||
br label %loop.body | ||
|
||
loop.body: | ||
br label %inner.block | ||
|
||
; This branch should not cause %inner.block to appear as an entry. | ||
unreachable.block: | ||
br label %inner.block | ||
|
||
inner.block: | ||
br i1 undef, label %loop.exit, label %loop.latch | ||
|
||
loop.latch: | ||
br label %loop.body | ||
|
||
loop.exit: | ||
ret void | ||
} |