2 ; RUN: opt -simple-loop-unswitch -disable-output -stats -info-output-file - < %s | FileCheck --check-prefix=STATS %s
3 ; RUN: opt -simple-loop-unswitch -S < %s | FileCheck %s
4 ; RUN: opt -simple-loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -S < %s | FileCheck %s
7 ; Loop unswitching shouldn't trivially unswitch the true case of condition %a
8 ; in the code here because it leads to an infinite loop. While this doesn't
9 ; contain any instructions with side effects, it's still a kind of side effect.
10 ; It can trivially unswitch on the false cas of condition %a though.
12 ; STATS: 2 simple-loop-unswitch - Number of branches unswitched
13 ; STATS: 2 simple-loop-unswitch - Number of unswitches that are trivial
15 ; CHECK-LABEL: @func_16(
17 ; CHECK-NEXT: br i1 %a, label %entry.split, label %abort0
20 ; CHECK-NEXT: br i1 %b, label %entry.split.split, label %abort1
22 ; CHECK: entry.split.split:
23 ; CHECK-NEXT: br label %for.body
26 ; CHECK-NEXT: br label %cond.end
29 ; CHECK-NEXT: br label %for.body
32 ; CHECK-NEXT: call void @end0() [[NOR_NUW:#[0-9]+]]
33 ; CHECK-NEXT: unreachable
36 ; CHECK-NEXT: call void @end1() [[NOR_NUW]]
37 ; CHECK-NEXT: unreachable
41 define void @func_16(i1 %a, i1 %b) nounwind {
46 br i1 %a, label %cond.end, label %abort0
49 br i1 %b, label %for.body, label %abort1
52 call void @end0() noreturn nounwind
56 call void @end1() noreturn nounwind
60 declare void @end0() noreturn
61 declare void @end1() noreturn
63 ; CHECK: attributes #0 = { nounwind }
64 ; CHECK: attributes #1 = { noreturn }
65 ; CHECK: attributes [[NOR_NUW]] = { noreturn nounwind }