1 ; RUN: opt < %s -lcssa -loop-simplify -indvars -S | FileCheck %s
2 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-unknown-unknown"
5 @a = external global i32, align 4
7 ; Check that loop-simplify merges two loop exits, but preserves LCSSA form.
10 ; CHECK: %or.cond = and i1 %cmp1, %cmp2
11 ; CHECK-NOT: for.cond:
13 ; CHECK: %a.lcssa = phi i32 [ %a, %for ]
14 define i32 @foo(i32 %x) {
19 %iv = phi i32 [ 0, %entry ], [ %iv.next, %for.cond ]
20 %cmp1 = icmp eq i32 %x, 0
21 %iv.next = add nuw nsw i32 %iv, 1
22 %a = load i32, i32* @a
23 br i1 %cmp1, label %for.cond, label %for.end
26 %cmp2 = icmp slt i32 %iv.next, 4
27 br i1 %cmp2, label %for, label %for.end
30 %a.lcssa = phi i32 [ %a, %for ], [ %a, %for.cond ]