2 ; RUN: opt -loop-unswitch -enable-new-pm=0 -verify-memoryssa -disable-output -stats -info-output-file - < %s | FileCheck --check-prefix=STATS %s
3 ; RUN: opt -loop-unswitch -enable-new-pm=0 -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s
6 ; Loop unswitching shouldn't trivially unswitch the true case of condition %a
7 ; in the code here because it leads to an infinite loop. While this doesn't
8 ; contain any instructions with side effects, it's still a kind of side effect.
9 ; It can trivially unswitch on the false case of condition %a though.
11 ; STATS: 2 loop-unswitch - Number of branches unswitched
12 ; STATS: 2 loop-unswitch - Number of unswitches that are trivial
14 ; CHECK-LABEL: @func_16(
16 ; CHECK-NEXT: br i1 %a, label %entry.split, label %abort0.split
19 ; CHECK-NEXT: br i1 %b, label %for.body, label %abort1.split
22 ; CHECK-NEXT: br label %for.body
24 ; CHECK: abort0.split:
25 ; CHECK-NEXT: call void @end0() [[NOR_NUW:#[0-9]+]]
26 ; CHECK-NEXT: unreachable
28 ; CHECK: abort1.split:
29 ; CHECK-NEXT: call void @end1() [[NOR_NUW]]
30 ; CHECK-NEXT: unreachable
34 define void @func_16(i1 %a, i1 %b) nounwind {
39 br i1 %a, label %cond.end, label %abort0
42 br i1 %b, label %for.body, label %abort1
45 call void @end0() noreturn nounwind
49 call void @end1() noreturn nounwind
53 declare void @end0() noreturn
54 declare void @end1() noreturn
56 ; CHECK: attributes #0 = { nounwind }
57 ; CHECK: attributes #1 = { noreturn }
58 ; CHECK: attributes [[NOR_NUW]] = { noreturn nounwind }