llvm-project/llvm/test/Transforms/IndVarSimplify/lftr-zext.ll

42 lines
1.8 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -indvars -S | FileCheck %s
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"
target triple = "x86_64-apple-macosx10.9.0"
@data = common global [240 x i8] zeroinitializer, align 16
define void @foo(i8* %a) #0 {
; CHECK-LABEL: @foo(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[LOOP:%.*]]
; CHECK: loop:
; CHECK-NEXT: [[P_0:%.*]] = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), [[ENTRY:%.*]] ], [ [[TMP3:%.*]], [[LOOP]] ]
; CHECK-NEXT: [[DOT0:%.*]] = phi i8* [ [[A:%.*]], [[ENTRY]] ], [ [[TMP:%.*]], [[LOOP]] ]
; CHECK-NEXT: [[TMP]] = getelementptr inbounds i8, i8* [[DOT0]], i64 1
; CHECK-NEXT: [[TMP2:%.*]] = load i8, i8* [[DOT0]], align 1
; CHECK-NEXT: [[TMP3]] = getelementptr inbounds i8, i8* [[P_0]], i64 1
; CHECK-NEXT: store i8 [[TMP2]], i8* [[P_0]], align 1
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp ne i8* [[TMP3]], getelementptr (i8, i8* getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), i64 240)
; CHECK-NEXT: br i1 [[EXITCOND]], label [[LOOP]], label [[EXIT:%.*]]
; CHECK: exit:
; CHECK-NEXT: ret void
;
entry:
br label %loop
loop:
%i.0 = phi i8 [ 0, %entry ], [ %tmp4, %loop ]
%p.0 = phi i8* [ getelementptr inbounds ([240 x i8], [240 x i8]* @data, i64 0, i64 0), %entry ], [ %tmp3, %loop ]
%.0 = phi i8* [ %a, %entry ], [ %tmp, %loop ]
%tmp = getelementptr inbounds i8, i8* %.0, i64 1
%tmp2 = load i8, i8* %.0, align 1
%tmp3 = getelementptr inbounds i8, i8* %p.0, i64 1
store i8 %tmp2, i8* %p.0, align 1
%tmp4 = add i8 %i.0, 1
%tmp5 = icmp ult i8 %tmp4, -16
br i1 %tmp5, label %loop, label %exit
exit:
ret void
}