1 ; RUN: opt < %s -simple-loop-unswitch -S 2>&1 | FileCheck %s
2 ; RUN: opt < %s -simple-loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -S 2>&1 | FileCheck %s
4 ; This is to test trivial loop unswitch only happens when trivial condition
5 ; itself is an LIV loop condition (not partial LIV which could occur in and/or).
7 define i32 @test(i1 %cond1, i32 %var1) {
8 ; CHECK-LABEL: define i32 @test(
12 ; CHECK-NEXT: br i1 %cond1, 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