-; RUN: opt < %s -indvars -enable-iv-rewrite=false -S | FileCheck %s
+; RUN: opt < %s -indvars -S | FileCheck %s
;
; Make sure that indvars isn't inserting canonical IVs.
; This is kinda hard to do until linear function test replacement is removed.
; back to the loop iv.
;
; CHECK: loop:
-; CHECK: phi i32
; CHECK-NOT: phi
; CHECK: exit:
loop:
%halfLim = ashr i32 %limit, 2
br label %loop
-; Test cloning an or, which is not an OverflowBinaryOperator.
+; This test originally checked that the OR instruction was cloned. Now the
+; ScalarEvolution is able to understand the loop evolution and that '%iv' at the
+; end of the loop is an even value. Thus '%val' is computed at the end of the
+; loop and the OR instruction is replaced by an ADD keeping the result
+; equivalent.
;
+; CHECK: sext
; CHECK: loop:
; CHECK: phi i64
; CHECK-NOT: sext
-; CHECK: or i64
+; CHECK: icmp slt i64
; CHECK: exit:
+; CHECK: add i64
loop:
%iv = phi i32 [ 0, %entry], [ %iv.next, %loop ]
%t1 = sext i32 %iv to i64
; CHECK-NOT: phi
; CHECK: add i32
; CHECK: add i32
+; CHECK: add i32
; CHECK-NOT: add
; CHECK: return:
;
; CHECK: loop:
; CHECK: phi %structIF*
-; CHECK: phi i32*
-; CHECK: getelementptr inbounds
+; CHECK-NOT: phi
; CHECK: getelementptr inbounds
+; CHECK-NOT: getelementptr
; CHECK: exit:
loop:
%ptr.iv = phi %structIF* [ %ptr.inc, %latch ], [ %base, %entry ]