1 ; RUN: opt -loop-unswitch -disable-output -stats -info-output-file - < %s | FileCheck --check-prefix=STATS %s
2 ; RUN: opt -loop-unswitch -simplifycfg -S < %s | FileCheck %s
5 ; Loop unswitching shouldn't trivially unswitch the true case of condition %a
6 ; in the code here because it leads to an infinite loop. While this doesn't
7 ; contain any instructions with side effects, it's still a kind of side effect.
8 ; It can trivially unswitch on the false cas of condition %a though.
10 ; STATS: 2 loop-unswitch - Number of branches unswitched
11 ; STATS: 1 loop-unswitch - Number of unswitches that are trivial
15 ; CHECK-NEXT: br i1 %a, label %entry.split, label %abort0.split
18 ; CHECK-NEXT: br i1 %b, label %cond.end.us, label %abort1
21 ; CHECK-NEXT: br label %cond.end.us
23 ; CHECK: abort0.split:
24 ; CHECK-NEXT: call void @end0() noreturn nounwind
25 ; CHECK-NEXT: unreachable
28 ; CHECK-NEXT: call void @end1() noreturn nounwind
29 ; CHECK-NEXT: unreachable
33 define void @func_16(i1 %a, i1 %b) nounwind {
38 br i1 %a, label %cond.end, label %abort0
41 br i1 %b, label %for.body, label %abort1
44 call void @end0() noreturn nounwind
48 call void @end1() noreturn nounwind
52 declare void @end0() noreturn
53 declare void @end1() noreturn