1; RUN: opt < %s -indvars -S | not grep sext 2 3; Provide legal integer types. 4target datalayout = "n8:16:32:64" 5 6 7define i64 @test(i64* nocapture %first, i32 %count) nounwind readonly { 8entry: 9 %t0 = icmp sgt i32 %count, 0 ; <i1> [#uses=1] 10 br i1 %t0, label %bb.nph, label %bb2 11 12bb.nph: ; preds = %entry 13 br label %bb 14 15bb: ; preds = %bb1, %bb.nph 16 %result.02 = phi i64 [ %t5, %bb1 ], [ 0, %bb.nph ] ; <i64> [#uses=1] 17 %n.01 = phi i32 [ %t6, %bb1 ], [ 0, %bb.nph ] ; <i32> [#uses=2] 18 %t1 = sext i32 %n.01 to i64 ; <i64> [#uses=1] 19 %t2 = getelementptr i64, i64* %first, i64 %t1 ; <i64*> [#uses=1] 20 %t3 = load i64, i64* %t2, align 8 ; <i64> [#uses=1] 21 %t4 = lshr i64 %t3, 4 ; <i64> [#uses=1] 22 %t5 = add i64 %t4, %result.02 ; <i64> [#uses=2] 23 %t6 = add i32 %n.01, 1 ; <i32> [#uses=2] 24 br label %bb1 25 26bb1: ; preds = %bb 27 %t7 = icmp slt i32 %t6, %count ; <i1> [#uses=1] 28 br i1 %t7, label %bb, label %bb1.bb2_crit_edge 29 30bb1.bb2_crit_edge: ; preds = %bb1 31 %.lcssa = phi i64 [ %t5, %bb1 ] ; <i64> [#uses=1] 32 br label %bb2 33 34bb2: ; preds = %bb1.bb2_crit_edge, %entry 35 %result.0.lcssa = phi i64 [ %.lcssa, %bb1.bb2_crit_edge ], [ 0, %entry ] ; <i64> [#uses=1] 36 ret i64 %result.0.lcssa 37} 38 39define void @foo(i16 signext %N, i32* nocapture %P) nounwind { 40entry: 41 %t0 = icmp sgt i16 %N, 0 ; <i1> [#uses=1] 42 br i1 %t0, label %bb.nph, label %return 43 44bb.nph: ; preds = %entry 45 br label %bb 46 47bb: ; preds = %bb1, %bb.nph 48 %i.01 = phi i16 [ %t3, %bb1 ], [ 0, %bb.nph ] ; <i16> [#uses=2] 49 %t1 = sext i16 %i.01 to i64 ; <i64> [#uses=1] 50 %t2 = getelementptr i32, i32* %P, i64 %t1 ; <i32*> [#uses=1] 51 store i32 123, i32* %t2, align 4 52 %t3 = add i16 %i.01, 1 ; <i16> [#uses=2] 53 br label %bb1 54 55bb1: ; preds = %bb 56 %t4 = icmp slt i16 %t3, %N ; <i1> [#uses=1] 57 br i1 %t4, label %bb, label %bb1.return_crit_edge 58 59bb1.return_crit_edge: ; preds = %bb1 60 br label %return 61 62return: ; preds = %bb1.return_crit_edge, %entry 63 ret void 64} 65 66; Test cases from PR1301: 67 68define void @kinds__srangezero([21 x i32]* nocapture %a) nounwind { 69bb.thread: 70 br label %bb 71 72bb: ; preds = %bb, %bb.thread 73 %i.0.reg2mem.0 = phi i8 [ -10, %bb.thread ], [ %tmp7, %bb ] ; <i8> [#uses=2] 74 %tmp12 = sext i8 %i.0.reg2mem.0 to i32 ; <i32> [#uses=1] 75 %tmp4 = add i32 %tmp12, 10 ; <i32> [#uses=1] 76 %tmp5 = getelementptr [21 x i32], [21 x i32]* %a, i32 0, i32 %tmp4 ; <i32*> [#uses=1] 77 store i32 0, i32* %tmp5 78 %tmp7 = add i8 %i.0.reg2mem.0, 1 ; <i8> [#uses=2] 79 %0 = icmp sgt i8 %tmp7, 10 ; <i1> [#uses=1] 80 br i1 %0, label %return, label %bb 81 82return: ; preds = %bb 83 ret void 84} 85 86define void @kinds__urangezero([21 x i32]* nocapture %a) nounwind { 87bb.thread: 88 br label %bb 89 90bb: ; preds = %bb, %bb.thread 91 %i.0.reg2mem.0 = phi i8 [ 10, %bb.thread ], [ %tmp7, %bb ] ; <i8> [#uses=2] 92 %tmp12 = sext i8 %i.0.reg2mem.0 to i32 ; <i32> [#uses=1] 93 %tmp4 = add i32 %tmp12, -10 ; <i32> [#uses=1] 94 %tmp5 = getelementptr [21 x i32], [21 x i32]* %a, i32 0, i32 %tmp4 ; <i32*> [#uses=1] 95 store i32 0, i32* %tmp5 96 %tmp7 = add i8 %i.0.reg2mem.0, 1 ; <i8> [#uses=2] 97 %0 = icmp sgt i8 %tmp7, 30 ; <i1> [#uses=1] 98 br i1 %0, label %return, label %bb 99 100return: ; preds = %bb 101 ret void 102} 103