1 ; RUN: opt < %s -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: br i1 %cond1, label %entry.split, label %loop_exit.split
14 ; CHECK-NEXT: br label %loop_begin
17 %var3 = phi i32 [%var1, %entry], [%var2, %do_something]
18 %cond2 = icmp eq i32 %var3, 10
19 %cond.and = and i1 %cond1, %cond2
20 br i1 %cond.and, label %do_something, label %loop_exit
22 ; CHECK-NEXT: %[[VAR3:.*]] = phi i32
23 ; CHECK-NEXT: %[[COND2:.*]] = icmp eq i32 %[[VAR3]], 10
24 ; CHECK-NEXT: %[[COND_AND:.*]] = and i1 true, %[[COND2]]
25 ; CHECK-NEXT: br i1 %[[COND_AND]], label %do_something, label %loop_exit
28 %var2 = add i32 %var3, 1
29 call void @some_func() noreturn nounwind
36 declare void @some_func() noreturn