85 lines
4.1 KiB
LLVM
85 lines
4.1 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -loop-vectorize -S -mtriple=aarch64-unknown-linux-gnu -force-vector-interleave=1 -force-vector-width=4 < %s | FileCheck %s
|
|
|
|
; The test checks that there is no assert caused by issue described in PR36032
|
|
|
|
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
|
|
|
|
%struct.anon = type { i8 }
|
|
|
|
@c = local_unnamed_addr global [6 x i8] zeroinitializer, align 1
|
|
@b = internal global %struct.anon zeroinitializer, align 1
|
|
|
|
; Function Attrs: noreturn nounwind
|
|
define void @_Z1dv() local_unnamed_addr #0 {
|
|
; CHECK-LABEL: @_Z1dv(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[CALL:%.*]] = tail call i8* @"_ZN3$_01aEv"(%struct.anon* nonnull @b)
|
|
; CHECK-NEXT: br label [[FOR_COND:%.*]]
|
|
; CHECK: for.cond:
|
|
; CHECK-NEXT: [[F_0:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[ADD5:%.*]], [[FOR_COND_CLEANUP:%.*]] ]
|
|
; CHECK-NEXT: [[G_0:%.*]] = phi i32 [ undef, [[ENTRY]] ], [ [[G_1_LCSSA:%.*]], [[FOR_COND_CLEANUP]] ]
|
|
; CHECK-NEXT: [[CMP12:%.*]] = icmp ult i32 [[G_0]], 4
|
|
; CHECK-NEXT: [[CONV:%.*]] = and i32 [[F_0]], 65535
|
|
; CHECK-NEXT: br i1 [[CMP12]], label [[FOR_BODY_LR_PH:%.*]], label [[FOR_COND_CLEANUP]]
|
|
; CHECK: for.body.lr.ph:
|
|
; CHECK-NEXT: [[TMP0:%.*]] = zext i32 [[G_0]] to i64
|
|
; CHECK-NEXT: br label [[FOR_BODY:%.*]]
|
|
; CHECK: for.cond.cleanup.loopexit:
|
|
; CHECK-NEXT: br label [[FOR_COND_CLEANUP]]
|
|
; CHECK: for.cond.cleanup:
|
|
; CHECK-NEXT: [[G_1_LCSSA]] = phi i32 [ [[G_0]], [[FOR_COND]] ], [ 4, [[FOR_COND_CLEANUP_LOOPEXIT:%.*]] ]
|
|
; CHECK-NEXT: [[ADD5]] = add nuw nsw i32 [[CONV]], 4
|
|
; CHECK-NEXT: br label [[FOR_COND]]
|
|
; CHECK: for.body:
|
|
; CHECK-NEXT: [[INDVARS_IV:%.*]] = phi i64 [ [[TMP0]], [[FOR_BODY_LR_PH]] ], [ [[INDVARS_IV_NEXT:%.*]], [[FOR_BODY]] ]
|
|
; CHECK-NEXT: [[TMP1:%.*]] = trunc i64 [[INDVARS_IV]] to i32
|
|
; CHECK-NEXT: [[ADD:%.*]] = add i32 [[CONV]], [[TMP1]]
|
|
; CHECK-NEXT: [[IDXPROM:%.*]] = zext i32 [[ADD]] to i64
|
|
; CHECK-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [6 x i8], [6 x i8]* @c, i64 0, i64 [[IDXPROM]]
|
|
; CHECK-NEXT: [[TMP2:%.*]] = load i8, i8* [[ARRAYIDX]], align 1
|
|
; CHECK-NEXT: [[ARRAYIDX3:%.*]] = getelementptr inbounds i8, i8* [[CALL]], i64 [[INDVARS_IV]]
|
|
; CHECK-NEXT: store i8 [[TMP2]], i8* [[ARRAYIDX3]], align 1
|
|
; CHECK-NEXT: [[INDVARS_IV_NEXT]] = add nuw nsw i64 [[INDVARS_IV]], 1
|
|
; CHECK-NEXT: [[EXITCOND:%.*]] = icmp eq i64 [[INDVARS_IV_NEXT]], 4
|
|
; CHECK-NEXT: br i1 [[EXITCOND]], label [[FOR_COND_CLEANUP_LOOPEXIT]], label [[FOR_BODY]]
|
|
;
|
|
entry:
|
|
%call = tail call i8* @"_ZN3$_01aEv"(%struct.anon* nonnull @b) #2
|
|
br label %for.cond
|
|
|
|
for.cond: ; preds = %for.cond.cleanup, %entry
|
|
%f.0 = phi i32 [ 0, %entry ], [ %add5, %for.cond.cleanup ]
|
|
%g.0 = phi i32 [ undef, %entry ], [ %g.1.lcssa, %for.cond.cleanup ]
|
|
%cmp12 = icmp ult i32 %g.0, 4
|
|
%conv = and i32 %f.0, 65535
|
|
br i1 %cmp12, label %for.body.lr.ph, label %for.cond.cleanup
|
|
|
|
for.body.lr.ph: ; preds = %for.cond
|
|
%0 = zext i32 %g.0 to i64
|
|
br label %for.body
|
|
|
|
for.cond.cleanup.loopexit: ; preds = %for.body
|
|
br label %for.cond.cleanup
|
|
|
|
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %for.cond
|
|
%g.1.lcssa = phi i32 [ %g.0, %for.cond ], [ 4, %for.cond.cleanup.loopexit ]
|
|
%add5 = add nuw nsw i32 %conv, 4
|
|
br label %for.cond
|
|
|
|
for.body: ; preds = %for.body, %for.body.lr.ph
|
|
%indvars.iv = phi i64 [ %0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ]
|
|
%1 = trunc i64 %indvars.iv to i32
|
|
%add = add i32 %conv, %1
|
|
%idxprom = zext i32 %add to i64
|
|
%arrayidx = getelementptr inbounds [6 x i8], [6 x i8]* @c, i64 0, i64 %idxprom
|
|
%2 = load i8, i8* %arrayidx, align 1
|
|
%arrayidx3 = getelementptr inbounds i8, i8* %call, i64 %indvars.iv
|
|
store i8 %2, i8* %arrayidx3, align 1
|
|
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
|
|
%exitcond = icmp eq i64 %indvars.iv.next, 4
|
|
br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body
|
|
}
|
|
|
|
declare i8* @"_ZN3$_01aEv"(%struct.anon*) local_unnamed_addr #1
|