1 ; RUN: opt < %s -passes="loop-mssa(simple-loop-unswitch)" -verify-memoryssa -S 2>&1 | FileCheck %s
3 ; This is to test trivial loop unswitch only happens when trivial condition
4 ; itself is an LIV loop condition (not partial LIV which could occur in and/or).
6 define i32 @test(i1 %cond1, i32 %var1) {
7 ; CHECK-LABEL: define i32 @test(
11 ; CHECK-NEXT: [[FROZEN:%.+]] = freeze i1 %cond1
12 ; CHECK-NEXT: br i1 [[FROZEN]], label %entry.split, label %loop_exit.split
15 ; CHECK-NEXT: br label %loop_begin
18 %var3 = phi i32 [%var1, %entry], [%var2, %do_something]
19 %cond2 = icmp eq i32 %var3, 10
20 %cond.and = and i1 %cond1, %cond2
21 br i1 %cond.and, label %do_something, label %loop_exit
23 ; CHECK-NEXT: %[[VAR3:.*]] = phi i32
24 ; CHECK-NEXT: %[[COND2:.*]] = icmp eq i32 %[[VAR3]], 10
25 ; CHECK-NEXT: %[[COND_AND:.*]] = and i1 true, %[[COND2]]
26 ; CHECK-NEXT: br i1 %[[COND_AND]], label %do_something, label %loop_exit
29 %var2 = add i32 %var3, 1
30 call void @some_func() noreturn nounwind
37 declare void @some_func() noreturn