Re-apply r251050 with a for PR25421
[oota-llvm.git] / test / Transforms / IndVarSimplify / lftr-zext.ll
1 ; RUN: opt < %s -indvars -S | FileCheck %s
2 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
3 target triple = "x86_64-apple-macosx10.9.0"
4
5 @data = common global [240 x i8] zeroinitializer, align 16
6
7 define void @foo(i8* %a) nounwind uwtable ssp {
8 ; CHECK: %exitcond
9 ; CHECK-NOT: ([240 x i8]* @data, i64 0, i64 -16)
10   br label %1
11
12 ; <label>:1                                       ; preds = %0, %1
13   %i.0 = phi i8 [ 0, %0 ], [ %5, %1 ]
14   %p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %0 ], [ %4, %1 ]
15   %.0 = phi i8* [ %a, %0 ], [ %2, %1 ]
16   %2 = getelementptr inbounds i8, i8* %.0, i64 1
17   %3 = load i8, i8* %.0, align 1
18   %4 = getelementptr inbounds i8, i8* %p.0, i64 1
19   store i8 %3, i8* %p.0, align 1
20   %5 = add i8 %i.0, 1
21   %6 = icmp ult i8 %5, -16
22   br i1 %6, label %1, label %7
23
24 ; <label>:7                                       ; preds = %1
25   ret void
26 }