1 ; RUN: opt -S < %s -passes='loop-mssa(loop-rotate,licm)' -verify-dom-info -verify-loop-info | FileCheck %s
2 ; PR2624 unroll multiple exits
4 @mode_table = global [4 x i32] zeroinitializer ; <ptr> [#uses=1]
10 tail call i32 @fegetround( ) ; <i32>:0 [#uses=1]
13 bb: ; preds = %bb4, %entry
14 %mode.0 = phi i8 [ 0, %entry ], [ %indvar.next, %bb4 ] ; <i8> [#uses=4]
15 zext i8 %mode.0 to i32 ; <i32>:1 [#uses=1]
16 getelementptr [4 x i32], ptr @mode_table, i32 0, i32 %1 ; <ptr>:2 [#uses=1]
17 load i32, ptr %2, align 4 ; <i32>:3 [#uses=1]
18 icmp eq i32 %3, %0 ; <i1>:4 [#uses=1]
19 br i1 %4, label %bb1, label %bb2
25 icmp eq i8 %mode.0, 1 ; <i1>:5 [#uses=1]
26 br i1 %5, label %bb5, label %bb4
29 %indvar.next = add i8 %mode.0, 1 ; <i8> [#uses=1]
33 tail call void @raise_exception( ) noreturn
37 declare i32 @fegetround()
39 declare void @raise_exception() noreturn
41 ;CHECK: for.body.lr.ph:
42 ;CHECK-NEXT: %0 = load i8, ptr %CurPtr, align 1
43 ;CHECK-NEXT: %conv2 = sext i8 %0 to i32
44 ;CHECK-NEXT: br label %for.body
46 define i32 @foo(ptr %CurPtr, i32 %a) #0 {
50 for.cond: ; preds = %for.inc, %entry
51 %i.0 = phi i32 [ 1, %entry ], [ %inc, %for.inc ]
52 %cmp = icmp ne i32 %i.0, %a
53 br i1 %cmp, label %for.body, label %return
55 for.body: ; preds = %for.cond
56 %idxprom = zext i32 %i.0 to i64
57 %arrayidx = getelementptr inbounds i8, ptr %CurPtr, i64 %idxprom
58 %0 = load i8, ptr %arrayidx, align 1
59 %conv = sext i8 %0 to i32
60 %1 = load i8, ptr %CurPtr, align 1
61 %conv2 = sext i8 %1 to i32
62 %cmp3 = icmp ne i32 %conv, %conv2
63 br i1 %cmp3, label %return, label %for.inc
65 for.inc: ; preds = %for.body
66 %inc = add i32 %i.0, 1
69 return: ; preds = %for.cond, %for.body
70 %retval.0 = phi i32 [ 0, %for.body ], [ 1, %for.cond ]
74 attributes #0 = { nounwind uwtable }