[SCEV] identical instructions don't compute equal values
[oota-llvm.git] / test / Transforms / IndVarSimplify / pr24952.ll
1 ; RUN: opt -indvars -S < %s | FileCheck %s
2
3 declare void @use(i1)
4
5 define void @f() {
6 ; CHECK-LABEL: @f(
7  entry:
8   %x = alloca i32
9   %y = alloca i32
10   br label %loop
11
12  loop:
13   %iv = phi i32 [ 0, %entry ], [ %iv.inc, %loop ]
14   %iv.inc = add i32 %iv, 1
15
16   %x.gep = getelementptr i32, i32* %x, i32 %iv
17   %eql = icmp eq i32* %x.gep, %y
18 ; CHECK-NOT: @use(i1 true)
19   call void @use(i1 %eql)
20
21   ; %be.cond deliberately 'false' -- we want want the trip count to be 0.
22   %be.cond = icmp ult i32 %iv, 0
23   br i1 %be.cond, label %loop, label %leave
24
25  leave:
26   ret void
27 }