diff options
author | Stephen Hines <srhines@google.com> | 2015-03-23 12:10:34 -0700 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2015-03-23 12:10:34 -0700 |
commit | ebe69fe11e48d322045d5949c83283927a0d790b (patch) | |
tree | c92f1907a6b8006628a4b01615f38264d29834ea /test/Transforms/LoopVectorize | |
parent | b7d2e72b02a4cb8034f32f8247a2558d2434e121 (diff) | |
download | external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.zip external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.gz external_llvm-ebe69fe11e48d322045d5949c83283927a0d790b.tar.bz2 |
Update aosp/master LLVM for rebase to r230699.
Change-Id: I2b5be30509658cb8266be782de0ab24f9099f9b9
Diffstat (limited to 'test/Transforms/LoopVectorize')
40 files changed, 1207 insertions, 473 deletions
diff --git a/test/Transforms/LoopVectorize/AArch64/arbitrary-induction-step.ll b/test/Transforms/LoopVectorize/AArch64/arbitrary-induction-step.ll new file mode 100644 index 0000000..95734bf --- /dev/null +++ b/test/Transforms/LoopVectorize/AArch64/arbitrary-induction-step.ll @@ -0,0 +1,150 @@ +; RUN: opt -S < %s -loop-vectorize 2>&1 | FileCheck %s +; RUN: opt -S < %s -loop-vectorize -force-vector-interleave=1 -force-vector-width=2 | FileCheck %s --check-prefix=FORCE-VEC + +target datalayout = "e-m:e-i64:64-i128:128-n32:64-S128" +target triple = "aarch64--linux-gnueabi" + +; Test integer induction variable of step 2: +; for (int i = 0; i < 1024; i+=2) { +; int tmp = *A++; +; sum += i * tmp; +; } + +; CHECK-LABEL: @ind_plus2( +; CHECK: load <4 x i32>* +; CHECK: load <4 x i32>* +; CHECK: mul nsw <4 x i32> +; CHECK: mul nsw <4 x i32> +; CHECK: add nsw <4 x i32> +; CHECK: add nsw <4 x i32> +; CHECK: %index.next = add i64 %index, 8 +; CHECK: icmp eq i64 %index.next, 512 + +; FORCE-VEC-LABEL: @ind_plus2( +; FORCE-VEC: %wide.load = load <2 x i32>* +; FORCE-VEC: mul nsw <2 x i32> +; FORCE-VEC: add nsw <2 x i32> +; FORCE-VEC: %index.next = add i64 %index, 2 +; FORCE-VEC: icmp eq i64 %index.next, 512 +define i32 @ind_plus2(i32* %A) { +entry: + br label %for.body + +for.body: ; preds = %entry, %for.body + %A.addr = phi i32* [ %A, %entry ], [ %inc.ptr, %for.body ] + %i = phi i32 [ 0, %entry ], [ %add1, %for.body ] + %sum = phi i32 [ 0, %entry ], [ %add, %for.body ] + %inc.ptr = getelementptr inbounds i32* %A.addr, i64 1 + %0 = load i32* %A.addr, align 4 + %mul = mul nsw i32 %0, %i + %add = add nsw i32 %mul, %sum + %add1 = add nsw i32 %i, 2 + %cmp = icmp slt i32 %add1, 1024 + br i1 %cmp, label %for.body, label %for.end + +for.end: ; preds = %for.body + %add.lcssa = phi i32 [ %add, %for.body ] + ret i32 %add.lcssa +} + + +; Test integer induction variable of step -2: +; for (int i = 1024; i > 0; i-=2) { +; int tmp = *A++; +; sum += i * tmp; +; } + +; CHECK-LABEL: @ind_minus2( +; CHECK: load <4 x i32>* +; CHECK: load <4 x i32>* +; CHECK: mul nsw <4 x i32> +; CHECK: mul nsw <4 x i32> +; CHECK: add nsw <4 x i32> +; CHECK: add nsw <4 x i32> +; CHECK: %index.next = add i64 %index, 8 +; CHECK: icmp eq i64 %index.next, 512 + +; FORCE-VEC-LABEL: @ind_minus2( +; FORCE-VEC: %wide.load = load <2 x i32>* +; FORCE-VEC: mul nsw <2 x i32> +; FORCE-VEC: add nsw <2 x i32> +; FORCE-VEC: %index.next = add i64 %index, 2 +; FORCE-VEC: icmp eq i64 %index.next, 512 +define i32 @ind_minus2(i32* %A) { +entry: + br label %for.body + +for.body: ; preds = %entry, %for.body + %A.addr = phi i32* [ %A, %entry ], [ %inc.ptr, %for.body ] + %i = phi i32 [ 1024, %entry ], [ %sub, %for.body ] + %sum = phi i32 [ 0, %entry ], [ %add, %for.body ] + %inc.ptr = getelementptr inbounds i32* %A.addr, i64 1 + %0 = load i32* %A.addr, align 4 + %mul = mul nsw i32 %0, %i + %add = add nsw i32 %mul, %sum + %sub = add nsw i32 %i, -2 + %cmp = icmp sgt i32 %i, 2 + br i1 %cmp, label %for.body, label %for.end + +for.end: ; preds = %for.body + %add.lcssa = phi i32 [ %add, %for.body ] + ret i32 %add.lcssa +} + + +; Test pointer induction variable of step 2. As currently we don't support +; masked load/store, vectorization is possible but not beneficial. If loop +; vectorization is not enforced, LV will only do interleave. +; for (int i = 0; i < 1024; i++) { +; int tmp0 = *A++; +; int tmp1 = *A++; +; sum += tmp0 * tmp1; +; } + +; CHECK-LABEL: @ptr_ind_plus2( +; CHECK: load i32* +; CHECK: load i32* +; CHECK: load i32* +; CHECK: load i32* +; CHECK: mul nsw i32 +; CHECK: mul nsw i32 +; CHECK: add nsw i32 +; CHECK: add nsw i32 +; CHECK: %index.next = add i64 %index, 2 +; CHECK: %21 = icmp eq i64 %index.next, 1024 + +; FORCE-VEC-LABEL: @ptr_ind_plus2( +; FORCE-VEC: load i32* +; FORCE-VEC: insertelement <2 x i32> +; FORCE-VEC: load i32* +; FORCE-VEC: insertelement <2 x i32> +; FORCE-VEC: load i32* +; FORCE-VEC: insertelement <2 x i32> +; FORCE-VEC: load i32* +; FORCE-VEC: insertelement <2 x i32> +; FORCE-VEC: mul nsw <2 x i32> +; FORCE-VEC: add nsw <2 x i32> +; FORCE-VEC: %index.next = add i64 %index, 2 +; FORCE-VEC: icmp eq i64 %index.next, 1024 +define i32 @ptr_ind_plus2(i32* %A) { +entry: + br label %for.body + +for.body: ; preds = %for.body, %entry + %A.addr = phi i32* [ %A, %entry ], [ %inc.ptr1, %for.body ] + %sum = phi i32 [ 0, %entry ], [ %add, %for.body ] + %i = phi i32 [ 0, %entry ], [ %inc, %for.body ] + %inc.ptr = getelementptr inbounds i32* %A.addr, i64 1 + %0 = load i32* %A.addr, align 4 + %inc.ptr1 = getelementptr inbounds i32* %A.addr, i64 2 + %1 = load i32* %inc.ptr, align 4 + %mul = mul nsw i32 %1, %0 + %add = add nsw i32 %mul, %sum + %inc = add nsw i32 %i, 1 + %exitcond = icmp eq i32 %inc, 1024 + br i1 %exitcond, label %for.end, label %for.body + +for.end: ; preds = %for.body + %add.lcssa = phi i32 [ %add, %for.body ] + ret i32 %add.lcssa +} diff --git a/test/Transforms/LoopVectorize/PowerPC/small-loop-rdx.ll b/test/Transforms/LoopVectorize/PowerPC/small-loop-rdx.ll new file mode 100644 index 0000000..25e7d24 --- /dev/null +++ b/test/Transforms/LoopVectorize/PowerPC/small-loop-rdx.ll @@ -0,0 +1,47 @@ +; RUN: opt < %s -loop-vectorize -S | FileCheck %s + +; CHECK: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT: fadd +; CHECK-NEXT-NOT: fadd + +target datalayout = "e-m:e-i64:64-n32:64" +target triple = "powerpc64le-ibm-linux-gnu" + +define void @test(double* nocapture readonly %arr, i32 signext %len) #0 { +entry: + %cmp4 = icmp sgt i32 %len, 0 + br i1 %cmp4, label %for.body.lr.ph, label %for.end + +for.body.lr.ph: ; preds = %entry + %0 = add i32 %len, -1 + br label %for.body + +for.body: ; preds = %for.body, %for.body.lr.ph + %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %for.body ] + %redx.05 = phi double [ 0.000000e+00, %for.body.lr.ph ], [ %add, %for.body ] + %arrayidx = getelementptr inbounds double* %arr, i64 %indvars.iv + %1 = load double* %arrayidx, align 8 + %add = fadd fast double %1, %redx.05 + %indvars.iv.next = add i64 %indvars.iv, 1 + %lftr.wideiv = trunc i64 %indvars.iv to i32 + %exitcond = icmp eq i32 %lftr.wideiv, %0 + br i1 %exitcond, label %for.end.loopexit, label %for.body + +for.end.loopexit: ; preds = %for.body + %add.lcssa = phi double [ %add, %for.body ] + br label %for.end + +for.end: ; preds = %for.end.loopexit, %entry + %redx.0.lcssa = phi double [ 0.000000e+00, %entry ], [ %add.lcssa, %for.end.loopexit ] + ret void +} diff --git a/test/Transforms/LoopVectorize/X86/already-vectorized.ll b/test/Transforms/LoopVectorize/X86/already-vectorized.ll index 9c69ba8..29d74a0 100644 --- a/test/Transforms/LoopVectorize/X86/already-vectorized.ll +++ b/test/Transforms/LoopVectorize/X86/already-vectorized.ll @@ -39,8 +39,8 @@ for.end: ; preds = %for.body } ; Now, we check for the Hint metadata -; CHECK: [[vect]] = metadata !{metadata [[vect]], metadata [[width:![0-9]+]], metadata [[unroll:![0-9]+]]} -; CHECK: [[width]] = metadata !{metadata !"llvm.loop.vectorize.width", i32 1} -; CHECK: [[unroll]] = metadata !{metadata !"llvm.loop.interleave.count", i32 1} -; CHECK: [[scalar]] = metadata !{metadata [[scalar]], metadata [[width]], metadata [[unroll]]} +; CHECK: [[vect]] = distinct !{[[vect]], [[width:![0-9]+]], [[unroll:![0-9]+]]} +; CHECK: [[width]] = !{!"llvm.loop.vectorize.width", i32 1} +; CHECK: [[unroll]] = !{!"llvm.loop.interleave.count", i32 1} +; CHECK: [[scalar]] = distinct !{[[scalar]], [[width]], [[unroll]]} diff --git a/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll b/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll index 0650d94..46efaf0 100644 --- a/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll +++ b/test/Transforms/LoopVectorize/X86/illegal-parallel-loop-uniform-write.ll @@ -50,7 +50,7 @@ for.end15: ; preds = %for.end.us, %entry attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -!3 = metadata !{metadata !4, metadata !5} -!4 = metadata !{metadata !4} -!5 = metadata !{metadata !5} +!3 = !{!4, !5} +!4 = !{!4} +!5 = !{!5} diff --git a/test/Transforms/LoopVectorize/X86/masked_load_store.ll b/test/Transforms/LoopVectorize/X86/masked_load_store.ll new file mode 100644 index 0000000..9e2de80 --- /dev/null +++ b/test/Transforms/LoopVectorize/X86/masked_load_store.ll @@ -0,0 +1,502 @@ +; RUN: opt < %s -O3 -mcpu=corei7-avx -S | FileCheck %s -check-prefix=AVX1 +; RUN: opt < %s -O3 -mcpu=core-avx2 -S | FileCheck %s -check-prefix=AVX2 +; RUN: opt < %s -O3 -mcpu=knl -S | FileCheck %s -check-prefix=AVX512 + +;AVX1-NOT: llvm.masked + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-pc_linux" + +; The source code: +; +;void foo1(int *A, int *B, int *trigger) { +; +; for (int i=0; i<10000; i++) { +; if (trigger[i] < 100) { +; A[i] = B[i] + trigger[i]; +; } +; } +;} + +;AVX2-LABEL: @foo1 +;AVX2: icmp slt <8 x i32> %wide.load, <i32 100, i32 100, i32 100 +;AVX2: call <8 x i32> @llvm.masked.load.v8i32 +;AVX2: add nsw <8 x i32> +;AVX2: call void @llvm.masked.store.v8i32 +;AVX2: ret void + +;AVX512-LABEL: @foo1 +;AVX512: icmp slt <16 x i32> %wide.load, <i32 100, i32 100, i32 100 +;AVX512: call <16 x i32> @llvm.masked.load.v16i32 +;AVX512: add nsw <16 x i32> +;AVX512: call void @llvm.masked.store.v16i32 +;AVX512: ret void + +; Function Attrs: nounwind uwtable +define void @foo1(i32* %A, i32* %B, i32* %trigger) { +entry: + %A.addr = alloca i32*, align 8 + %B.addr = alloca i32*, align 8 + %trigger.addr = alloca i32*, align 8 + %i = alloca i32, align 4 + store i32* %A, i32** %A.addr, align 8 + store i32* %B, i32** %B.addr, align 8 + store i32* %trigger, i32** %trigger.addr, align 8 + store i32 0, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32* %i, align 4 + %cmp = icmp slt i32 %0, 10000 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %1 = load i32* %i, align 4 + %idxprom = sext i32 %1 to i64 + %2 = load i32** %trigger.addr, align 8 + %arrayidx = getelementptr inbounds i32* %2, i64 %idxprom + %3 = load i32* %arrayidx, align 4 + %cmp1 = icmp slt i32 %3, 100 + br i1 %cmp1, label %if.then, label %if.end + +if.then: ; preds = %for.body + %4 = load i32* %i, align 4 + %idxprom2 = sext i32 %4 to i64 + %5 = load i32** %B.addr, align 8 + %arrayidx3 = getelementptr inbounds i32* %5, i64 %idxprom2 + %6 = load i32* %arrayidx3, align 4 + %7 = load i32* %i, align 4 + %idxprom4 = sext i32 %7 to i64 + %8 = load i32** %trigger.addr, align 8 + %arrayidx5 = getelementptr inbounds i32* %8, i64 %idxprom4 + %9 = load i32* %arrayidx5, align 4 + %add = add nsw i32 %6, %9 + %10 = load i32* %i, align 4 + %idxprom6 = sext i32 %10 to i64 + %11 = load i32** %A.addr, align 8 + %arrayidx7 = getelementptr inbounds i32* %11, i64 %idxprom6 + store i32 %add, i32* %arrayidx7, align 4 + br label %if.end + +if.end: ; preds = %if.then, %for.body + br label %for.inc + +for.inc: ; preds = %if.end + %12 = load i32* %i, align 4 + %inc = add nsw i32 %12, 1 + store i32 %inc, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + ret void +} + +; The source code: +; +;void foo2(float *A, float *B, int *trigger) { +; +; for (int i=0; i<10000; i++) { +; if (trigger[i] < 100) { +; A[i] = B[i] + trigger[i]; +; } +; } +;} + +;AVX2-LABEL: @foo2 +;AVX2: icmp slt <8 x i32> %wide.load, <i32 100, i32 100, i32 100 +;AVX2: call <8 x float> @llvm.masked.load.v8f32 +;AVX2: fadd <8 x float> +;AVX2: call void @llvm.masked.store.v8f32 +;AVX2: ret void + +;AVX512-LABEL: @foo2 +;AVX512: icmp slt <16 x i32> %wide.load, <i32 100, i32 100, i32 100 +;AVX512: call <16 x float> @llvm.masked.load.v16f32 +;AVX512: fadd <16 x float> +;AVX512: call void @llvm.masked.store.v16f32 +;AVX512: ret void + +; Function Attrs: nounwind uwtable +define void @foo2(float* %A, float* %B, i32* %trigger) { +entry: + %A.addr = alloca float*, align 8 + %B.addr = alloca float*, align 8 + %trigger.addr = alloca i32*, align 8 + %i = alloca i32, align 4 + store float* %A, float** %A.addr, align 8 + store float* %B, float** %B.addr, align 8 + store i32* %trigger, i32** %trigger.addr, align 8 + store i32 0, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32* %i, align 4 + %cmp = icmp slt i32 %0, 10000 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %1 = load i32* %i, align 4 + %idxprom = sext i32 %1 to i64 + %2 = load i32** %trigger.addr, align 8 + %arrayidx = getelementptr inbounds i32* %2, i64 %idxprom + %3 = load i32* %arrayidx, align 4 + %cmp1 = icmp slt i32 %3, 100 + br i1 %cmp1, label %if.then, label %if.end + +if.then: ; preds = %for.body + %4 = load i32* %i, align 4 + %idxprom2 = sext i32 %4 to i64 + %5 = load float** %B.addr, align 8 + %arrayidx3 = getelementptr inbounds float* %5, i64 %idxprom2 + %6 = load float* %arrayidx3, align 4 + %7 = load i32* %i, align 4 + %idxprom4 = sext i32 %7 to i64 + %8 = load i32** %trigger.addr, align 8 + %arrayidx5 = getelementptr inbounds i32* %8, i64 %idxprom4 + %9 = load i32* %arrayidx5, align 4 + %conv = sitofp i32 %9 to float + %add = fadd float %6, %conv + %10 = load i32* %i, align 4 + %idxprom6 = sext i32 %10 to i64 + %11 = load float** %A.addr, align 8 + %arrayidx7 = getelementptr inbounds float* %11, i64 %idxprom6 + store float %add, float* %arrayidx7, align 4 + br label %if.end + +if.end: ; preds = %if.then, %for.body + br label %for.inc + +for.inc: ; preds = %if.end + %12 = load i32* %i, align 4 + %inc = add nsw i32 %12, 1 + store i32 %inc, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + ret void +} + +; The source code: +; +;void foo3(double *A, double *B, int *trigger) { +; +; for (int i=0; i<10000; i++) { +; if (trigger[i] < 100) { +; A[i] = B[i] + trigger[i]; +; } +; } +;} + +;AVX2-LABEL: @foo3 +;AVX2: icmp slt <4 x i32> %wide.load, <i32 100, i32 100, +;AVX2: call <4 x double> @llvm.masked.load.v4f64 +;AVX2: sitofp <4 x i32> %wide.load to <4 x double> +;AVX2: fadd <4 x double> +;AVX2: call void @llvm.masked.store.v4f64 +;AVX2: ret void + +;AVX512-LABEL: @foo3 +;AVX512: icmp slt <8 x i32> %wide.load, <i32 100, i32 100, +;AVX512: call <8 x double> @llvm.masked.load.v8f64 +;AVX512: sitofp <8 x i32> %wide.load to <8 x double> +;AVX512: fadd <8 x double> +;AVX512: call void @llvm.masked.store.v8f64 +;AVX512: ret void + + +; Function Attrs: nounwind uwtable +define void @foo3(double* %A, double* %B, i32* %trigger) #0 { +entry: + %A.addr = alloca double*, align 8 + %B.addr = alloca double*, align 8 + %trigger.addr = alloca i32*, align 8 + %i = alloca i32, align 4 + store double* %A, double** %A.addr, align 8 + store double* %B, double** %B.addr, align 8 + store i32* %trigger, i32** %trigger.addr, align 8 + store i32 0, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32* %i, align 4 + %cmp = icmp slt i32 %0, 10000 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %1 = load i32* %i, align 4 + %idxprom = sext i32 %1 to i64 + %2 = load i32** %trigger.addr, align 8 + %arrayidx = getelementptr inbounds i32* %2, i64 %idxprom + %3 = load i32* %arrayidx, align 4 + %cmp1 = icmp slt i32 %3, 100 + br i1 %cmp1, label %if.then, label %if.end + +if.then: ; preds = %for.body + %4 = load i32* %i, align 4 + %idxprom2 = sext i32 %4 to i64 + %5 = load double** %B.addr, align 8 + %arrayidx3 = getelementptr inbounds double* %5, i64 %idxprom2 + %6 = load double* %arrayidx3, align 8 + %7 = load i32* %i, align 4 + %idxprom4 = sext i32 %7 to i64 + %8 = load i32** %trigger.addr, align 8 + %arrayidx5 = getelementptr inbounds i32* %8, i64 %idxprom4 + %9 = load i32* %arrayidx5, align 4 + %conv = sitofp i32 %9 to double + %add = fadd double %6, %conv + %10 = load i32* %i, align 4 + %idxprom6 = sext i32 %10 to i64 + %11 = load double** %A.addr, align 8 + %arrayidx7 = getelementptr inbounds double* %11, i64 %idxprom6 + store double %add, double* %arrayidx7, align 8 + br label %if.end + +if.end: ; preds = %if.then, %for.body + br label %for.inc + +for.inc: ; preds = %if.end + %12 = load i32* %i, align 4 + %inc = add nsw i32 %12, 1 + store i32 %inc, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + ret void +} + +; The source code: +; +;void foo4(double *A, double *B, int *trigger) { +; +; for (int i=0; i<10000; i++) { +; if (trigger[i] < 100) { +; A[i] = B[i*2] + trigger[i]; << non-cosecutive access +; } +; } +;} + +;AVX2-LABEL: @foo4 +;AVX2-NOT: llvm.masked +;AVX2: ret void + +;AVX512-LABEL: @foo4 +;AVX512-NOT: llvm.masked +;AVX512: ret void + +; Function Attrs: nounwind uwtable +define void @foo4(double* %A, double* %B, i32* %trigger) { +entry: + %A.addr = alloca double*, align 8 + %B.addr = alloca double*, align 8 + %trigger.addr = alloca i32*, align 8 + %i = alloca i32, align 4 + store double* %A, double** %A.addr, align 8 + store double* %B, double** %B.addr, align 8 + store i32* %trigger, i32** %trigger.addr, align 8 + store i32 0, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32* %i, align 4 + %cmp = icmp slt i32 %0, 10000 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %1 = load i32* %i, align 4 + %idxprom = sext i32 %1 to i64 + %2 = load i32** %trigger.addr, align 8 + %arrayidx = getelementptr inbounds i32* %2, i64 %idxprom + %3 = load i32* %arrayidx, align 4 + %cmp1 = icmp slt i32 %3, 100 + br i1 %cmp1, label %if.then, label %if.end + +if.then: ; preds = %for.body + %4 = load i32* %i, align 4 + %mul = mul nsw i32 %4, 2 + %idxprom2 = sext i32 %mul to i64 + %5 = load double** %B.addr, align 8 + %arrayidx3 = getelementptr inbounds double* %5, i64 %idxprom2 + %6 = load double* %arrayidx3, align 8 + %7 = load i32* %i, align 4 + %idxprom4 = sext i32 %7 to i64 + %8 = load i32** %trigger.addr, align 8 + %arrayidx5 = getelementptr inbounds i32* %8, i64 %idxprom4 + %9 = load i32* %arrayidx5, align 4 + %conv = sitofp i32 %9 to double + %add = fadd double %6, %conv + %10 = load i32* %i, align 4 + %idxprom6 = sext i32 %10 to i64 + %11 = load double** %A.addr, align 8 + %arrayidx7 = getelementptr inbounds double* %11, i64 %idxprom6 + store double %add, double* %arrayidx7, align 8 + br label %if.end + +if.end: ; preds = %if.then, %for.body + br label %for.inc + +for.inc: ; preds = %if.end + %12 = load i32* %i, align 4 + %inc = add nsw i32 %12, 1 + store i32 %inc, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + ret void +} + +@a = common global [1 x i32*] zeroinitializer, align 8 +@c = common global i32* null, align 8 + +; The loop here should not be vectorized due to trapping +; constant expression +;AVX2-LABEL: @foo5 +;AVX2-NOT: llvm.masked +;AVX2: store i32 sdiv +;AVX2: ret void + +;AVX512-LABEL: @foo5 +;AVX512-NOT: llvm.masked +;AVX512: store i32 sdiv +;AVX512: ret void + +; Function Attrs: nounwind uwtable +define void @foo5(i32* %A, i32* %B, i32* %trigger) { +entry: + %A.addr = alloca i32*, align 8 + %B.addr = alloca i32*, align 8 + %trigger.addr = alloca i32*, align 8 + %i = alloca i32, align 4 + store i32* %A, i32** %A.addr, align 8 + store i32* %B, i32** %B.addr, align 8 + store i32* %trigger, i32** %trigger.addr, align 8 + store i32 0, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32* %i, align 4 + %cmp = icmp slt i32 %0, 10000 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %1 = load i32* %i, align 4 + %idxprom = sext i32 %1 to i64 + %2 = load i32** %trigger.addr, align 8 + %arrayidx = getelementptr inbounds i32* %2, i64 %idxprom + %3 = load i32* %arrayidx, align 4 + %cmp1 = icmp slt i32 %3, 100 + br i1 %cmp1, label %if.then, label %if.end + +if.then: ; preds = %for.body + %4 = load i32* %i, align 4 + %idxprom2 = sext i32 %4 to i64 + %5 = load i32** %B.addr, align 8 + %arrayidx3 = getelementptr inbounds i32* %5, i64 %idxprom2 + %6 = load i32* %arrayidx3, align 4 + %7 = load i32* %i, align 4 + %idxprom4 = sext i32 %7 to i64 + %8 = load i32** %trigger.addr, align 8 + %arrayidx5 = getelementptr inbounds i32* %8, i64 %idxprom4 + %9 = load i32* %arrayidx5, align 4 + %add = add nsw i32 %6, %9 + %10 = load i32* %i, align 4 + %idxprom6 = sext i32 %10 to i64 + %11 = load i32** %A.addr, align 8 + %arrayidx7 = getelementptr inbounds i32* %11, i64 %idxprom6 + store i32 sdiv (i32 1, i32 zext (i1 icmp eq (i32** getelementptr inbounds ([1 x i32*]* @a, i64 0, i64 1), i32** @c) to i32)), i32* %arrayidx7, align 4 + br label %if.end + +if.end: ; preds = %if.then, %for.body + br label %for.inc + +for.inc: ; preds = %if.end + %12 = load i32* %i, align 4 + %inc = add nsw i32 %12, 1 + store i32 %inc, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + ret void +} + +; Reverse loop +;void foo6(double *in, double *out, unsigned size, int *trigger) { +; +; for (int i=SIZE-1; i>=0; i--) { +; if (trigger[i] > 0) { +; out[i] = in[i] + (double) 0.5; +; } +; } +;} +;AVX2-LABEL: @foo6 +;AVX2: icmp sgt <4 x i32> %reverse, zeroinitializer +;AVX2: shufflevector <4 x i1>{{.*}}<4 x i32> <i32 3, i32 2, i32 1, i32 0> +;AVX2: call <4 x double> @llvm.masked.load.v4f64 +;AVX2: fadd <4 x double> +;AVX2: call void @llvm.masked.store.v4f64 +;AVX2: ret void + +;AVX512-LABEL: @foo6 +;AVX512: icmp sgt <8 x i32> %reverse, zeroinitializer +;AVX512: shufflevector <8 x i1>{{.*}}<8 x i32> <i32 7, i32 6, i32 5, i32 4 +;AVX512: call <8 x double> @llvm.masked.load.v8f64 +;AVX512: fadd <8 x double> +;AVX512: call void @llvm.masked.store.v8f64 +;AVX512: ret void + + +define void @foo6(double* %in, double* %out, i32 %size, i32* %trigger) { +entry: + %in.addr = alloca double*, align 8 + %out.addr = alloca double*, align 8 + %size.addr = alloca i32, align 4 + %trigger.addr = alloca i32*, align 8 + %i = alloca i32, align 4 + store double* %in, double** %in.addr, align 8 + store double* %out, double** %out.addr, align 8 + store i32 %size, i32* %size.addr, align 4 + store i32* %trigger, i32** %trigger.addr, align 8 + store i32 4095, i32* %i, align 4 + br label %for.cond + +for.cond: ; preds = %for.inc, %entry + %0 = load i32* %i, align 4 + %cmp = icmp sge i32 %0, 0 + br i1 %cmp, label %for.body, label %for.end + +for.body: ; preds = %for.cond + %1 = load i32* %i, align 4 + %idxprom = sext i32 %1 to i64 + %2 = load i32** %trigger.addr, align 8 + %arrayidx = getelementptr inbounds i32* %2, i64 %idxprom + %3 = load i32* %arrayidx, align 4 + %cmp1 = icmp sgt i32 %3, 0 + br i1 %cmp1, label %if.then, label %if.end + +if.then: ; preds = %for.body + %4 = load i32* %i, align 4 + %idxprom2 = sext i32 %4 to i64 + %5 = load double** %in.addr, align 8 + %arrayidx3 = getelementptr inbounds double* %5, i64 %idxprom2 + %6 = load double* %arrayidx3, align 8 + %add = fadd double %6, 5.000000e-01 + %7 = load i32* %i, align 4 + %idxprom4 = sext i32 %7 to i64 + %8 = load double** %out.addr, align 8 + %arrayidx5 = getelementptr inbounds double* %8, i64 %idxprom4 + store double %add, double* %arrayidx5, align 8 + br label %if.end + +if.end: ; preds = %if.then, %for.body + br label %for.inc + +for.inc: ; preds = %if.end + %9 = load i32* %i, align 4 + %dec = add nsw i32 %9, -1 + store i32 %dec, i32* %i, align 4 + br label %for.cond + +for.end: ; preds = %for.cond + ret void +} + + diff --git a/test/Transforms/LoopVectorize/X86/metadata-enable.ll b/test/Transforms/LoopVectorize/X86/metadata-enable.ll index 8e0ca41..7feb66c 100644 --- a/test/Transforms/LoopVectorize/X86/metadata-enable.ll +++ b/test/Transforms/LoopVectorize/X86/metadata-enable.ll @@ -170,7 +170,7 @@ for.end: ; preds = %for.body ret i32 %1 } -!0 = metadata !{metadata !0, metadata !1} -!1 = metadata !{metadata !"llvm.loop.vectorize.enable", i1 1} -!2 = metadata !{metadata !2, metadata !3} -!3 = metadata !{metadata !"llvm.loop.vectorize.enable", i1 0} +!0 = !{!0, !1} +!1 = !{!"llvm.loop.vectorize.enable", i1 1} +!2 = !{!2, !3} +!3 = !{!"llvm.loop.vectorize.enable", i1 0} diff --git a/test/Transforms/LoopVectorize/X86/parallel-loops-after-reg2mem.ll b/test/Transforms/LoopVectorize/X86/parallel-loops-after-reg2mem.ll index 0b542a9..ad01044 100644 --- a/test/Transforms/LoopVectorize/X86/parallel-loops-after-reg2mem.ll +++ b/test/Transforms/LoopVectorize/X86/parallel-loops-after-reg2mem.ll @@ -46,4 +46,4 @@ for.end: ; preds = %for.body ret void } -!3 = metadata !{metadata !3} +!3 = !{!3} diff --git a/test/Transforms/LoopVectorize/X86/parallel-loops.ll b/test/Transforms/LoopVectorize/X86/parallel-loops.ll index b580d73..22ab521 100644 --- a/test/Transforms/LoopVectorize/X86/parallel-loops.ll +++ b/test/Transforms/LoopVectorize/X86/parallel-loops.ll @@ -104,8 +104,8 @@ for.end: ; preds = %for.body ret void } -!3 = metadata !{metadata !3} -!4 = metadata !{metadata !4} -!5 = metadata !{metadata !3, metadata !4} -!6 = metadata !{metadata !6} -!7 = metadata !{metadata !7} +!3 = !{!3} +!4 = !{!4} +!5 = !{!3, !4} +!6 = !{!6} +!7 = !{!7} diff --git a/test/Transforms/LoopVectorize/X86/small-size.ll b/test/Transforms/LoopVectorize/X86/small-size.ll index f9a0281..8c7a881 100644 --- a/test/Transforms/LoopVectorize/X86/small-size.ll +++ b/test/Transforms/LoopVectorize/X86/small-size.ll @@ -139,7 +139,7 @@ define void @example4(i32 %n, i32* noalias nocapture %p, i32* noalias nocapture ret void } -!0 = metadata !{metadata !"branch_weights", i32 64, i32 4} +!0 = !{!"branch_weights", i32 64, i32 4} ; We can't vectorize this one because we need a runtime ptr check. ;CHECK-LABEL: @example23( diff --git a/test/Transforms/LoopVectorize/X86/vect.omp.force.ll b/test/Transforms/LoopVectorize/X86/vect.omp.force.ll index 074313b..a781fbe 100644 --- a/test/Transforms/LoopVectorize/X86/vect.omp.force.ll +++ b/test/Transforms/LoopVectorize/X86/vect.omp.force.ll @@ -52,8 +52,8 @@ for.end: ret void } -!1 = metadata !{metadata !1, metadata !2} -!2 = metadata !{metadata !"llvm.loop.vectorize.enable", i1 true} +!1 = !{!1, !2} +!2 = !{!"llvm.loop.vectorize.enable", i1 true} ; ; This method will not be vectorized, as scalar cost is lower than any of vector costs. @@ -89,5 +89,5 @@ for.end: declare float @llvm.sin.f32(float) nounwind readnone ; Dummy metadata -!3 = metadata !{metadata !3} +!3 = !{!3} diff --git a/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll b/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll index 97c31a1..e39e6b5 100644 --- a/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll +++ b/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll @@ -43,8 +43,8 @@ for.end: ret void } -!1 = metadata !{metadata !1, metadata !2} -!2 = metadata !{metadata !"llvm.loop.vectorize.enable", i1 true} +!1 = !{!1, !2} +!2 = !{!"llvm.loop.vectorize.enable", i1 true} ; ; This loop will not be vectorized as the trip count is below the threshold. @@ -69,5 +69,5 @@ for.end: ret void } -!3 = metadata !{metadata !3} +!3 = !{!3} diff --git a/test/Transforms/LoopVectorize/X86/vector-scalar-select-cost.ll b/test/Transforms/LoopVectorize/X86/vector-scalar-select-cost.ll index 3b3a787..ece9895 100644 --- a/test/Transforms/LoopVectorize/X86/vector-scalar-select-cost.ll +++ b/test/Transforms/LoopVectorize/X86/vector-scalar-select-cost.ll @@ -50,8 +50,8 @@ define void @vectorselect(i1 %cond) { %7 = getelementptr inbounds [2048 x i32]* @a, i64 0, i64 %indvars.iv %8 = icmp ult i64 %indvars.iv, 8 -; A vector select has a cost of 4 on core2 -; CHECK: cost of 4 for VF 2 {{.*}} select i1 %8, i32 %6, i32 0 +; A vector select has a cost of 1 on core2 +; CHECK: cost of 1 for VF 2 {{.*}} select i1 %8, i32 %6, i32 0 %sel = select i1 %8, i32 %6, i32 zeroinitializer store i32 %sel, i32* %7, align 4 diff --git a/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll b/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll index 7bce11d..011ce8e 100644 --- a/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll +++ b/test/Transforms/LoopVectorize/X86/vectorization-remarks-missed.ll @@ -122,40 +122,40 @@ attributes #0 = { nounwind } !llvm.module.flags = !{!9, !10} !llvm.ident = !{!11} -!0 = metadata !{metadata !"0x11\004\00clang version 3.5.0\001\00\006\00\002", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [./source.cpp] [DW_LANG_C_plus_plus] -!1 = metadata !{metadata !"source.cpp", metadata !"."} -!2 = metadata !{} -!3 = metadata !{metadata !4, metadata !7, metadata !8} -!4 = metadata !{metadata !"0x2e\00test\00test\00\001\000\001\000\006\00256\001\001", metadata !1, metadata !5, metadata !6, null, void (i32*, i32)* @_Z4testPii, null, null, metadata !2} ; [ DW_TAG_subprogram ] [line 1] [def] [test] -!5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] [./source.cpp] -!6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !2, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] -!7 = metadata !{metadata !"0x2e\00test_disabled\00test_disabled\00\0010\000\001\000\006\00256\001\0010", metadata !1, metadata !5, metadata !6, null, void (i32*, i32)* @_Z13test_disabledPii, null, null, metadata !2} ; [ DW_TAG_subprogram ] [line 10] [def] [test_disabled] -!8 = metadata !{metadata !"0x2e\00test_array_bounds\00test_array_bounds\00\0016\000\001\000\006\00256\001\0016", metadata !1, metadata !5, metadata !6, null, void (i32*, i32*, i32)* @_Z17test_array_boundsPiS_i, null, null, metadata !2} ; [ DW_TAG_subprogram ] [line 16] [def] [test_array_bounds] -!9 = metadata !{i32 2, metadata !"Dwarf Version", i32 2} -!10 = metadata !{i32 2, metadata !"Debug Info Version", i32 2} -!11 = metadata !{metadata !"clang version 3.5.0"} -!12 = metadata !{i32 3, i32 8, metadata !13, null} -!13 = metadata !{metadata !"0xb\003\003\000", metadata !1, metadata !4} ; [ DW_TAG_lexical_block ] -!14 = metadata !{metadata !14, metadata !15, metadata !15} -!15 = metadata !{metadata !"llvm.loop.vectorize.enable", i1 true} -!16 = metadata !{i32 4, i32 5, metadata !17, null} -!17 = metadata !{metadata !"0xb\003\0036\000", metadata !1, metadata !13} ; [ DW_TAG_lexical_block ] -!18 = metadata !{metadata !19, metadata !19, i64 0} -!19 = metadata !{metadata !"int", metadata !20, i64 0} -!20 = metadata !{metadata !"omnipotent char", metadata !21, i64 0} -!21 = metadata !{metadata !"Simple C/C++ TBAA"} -!22 = metadata !{i32 5, i32 9, metadata !23, null} -!23 = metadata !{metadata !"0xb\005\009\000", metadata !1, metadata !17} ; [ DW_TAG_lexical_block ] -!24 = metadata !{i32 8, i32 1, metadata !4, null} -!25 = metadata !{i32 12, i32 8, metadata !26, null} -!26 = metadata !{metadata !"0xb\0012\003\000", metadata !1, metadata !7} ; [ DW_TAG_lexical_block ] -!27 = metadata !{metadata !27, metadata !28, metadata !29} -!28 = metadata !{metadata !"llvm.loop.interleave.count", i32 1} -!29 = metadata !{metadata !"llvm.loop.vectorize.width", i32 1} -!30 = metadata !{i32 13, i32 5, metadata !26, null} -!31 = metadata !{i32 14, i32 1, metadata !7, null} -!32 = metadata !{i32 18, i32 8, metadata !33, null} -!33 = metadata !{metadata !"0xb\0018\003\000", metadata !1, metadata !8} ; [ DW_TAG_lexical_block ] -!34 = metadata !{metadata !34, metadata !15} -!35 = metadata !{i32 19, i32 5, metadata !33, null} -!36 = metadata !{i32 20, i32 1, metadata !8, null} +!0 = !{!"0x11\004\00clang version 3.5.0\001\00\006\00\002", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [./source.cpp] [DW_LANG_C_plus_plus] +!1 = !{!"source.cpp", !"."} +!2 = !{} +!3 = !{!4, !7, !8} +!4 = !{!"0x2e\00test\00test\00\001\000\001\000\006\00256\001\001", !1, !5, !6, null, void (i32*, i32)* @_Z4testPii, null, null, !2} ; [ DW_TAG_subprogram ] [line 1] [def] [test] +!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [./source.cpp] +!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !2, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] +!7 = !{!"0x2e\00test_disabled\00test_disabled\00\0010\000\001\000\006\00256\001\0010", !1, !5, !6, null, void (i32*, i32)* @_Z13test_disabledPii, null, null, !2} ; [ DW_TAG_subprogram ] [line 10] [def] [test_disabled] +!8 = !{!"0x2e\00test_array_bounds\00test_array_bounds\00\0016\000\001\000\006\00256\001\0016", !1, !5, !6, null, void (i32*, i32*, i32)* @_Z17test_array_boundsPiS_i, null, null, !2} ; [ DW_TAG_subprogram ] [line 16] [def] [test_array_bounds] +!9 = !{i32 2, !"Dwarf Version", i32 2} +!10 = !{i32 2, !"Debug Info Version", i32 2} +!11 = !{!"clang version 3.5.0"} +!12 = !MDLocation(line: 3, column: 8, scope: !13) +!13 = !{!"0xb\003\003\000", !1, !4} ; [ DW_TAG_lexical_block ] +!14 = !{!14, !15, !15} +!15 = !{!"llvm.loop.vectorize.enable", i1 true} +!16 = !MDLocation(line: 4, column: 5, scope: !17) +!17 = !{!"0xb\003\0036\000", !1, !13} ; [ DW_TAG_lexical_block ] +!18 = !{!19, !19, i64 0} +!19 = !{!"int", !20, i64 0} +!20 = !{!"omnipotent char", !21, i64 0} +!21 = !{!"Simple C/C++ TBAA"} +!22 = !MDLocation(line: 5, column: 9, scope: !23) +!23 = !{!"0xb\005\009\000", !1, !17} ; [ DW_TAG_lexical_block ] +!24 = !MDLocation(line: 8, column: 1, scope: !4) +!25 = !MDLocation(line: 12, column: 8, scope: !26) +!26 = !{!"0xb\0012\003\000", !1, !7} ; [ DW_TAG_lexical_block ] +!27 = !{!27, !28, !29} +!28 = !{!"llvm.loop.interleave.count", i32 1} +!29 = !{!"llvm.loop.vectorize.width", i32 1} +!30 = !MDLocation(line: 13, column: 5, scope: !26) +!31 = !MDLocation(line: 14, column: 1, scope: !7) +!32 = !MDLocation(line: 18, column: 8, scope: !33) +!33 = !{!"0xb\0018\003\000", !1, !8} ; [ DW_TAG_lexical_block ] +!34 = !{!34, !15} +!35 = !MDLocation(line: 19, column: 5, scope: !33) +!36 = !MDLocation(line: 20, column: 1, scope: !8) diff --git a/test/Transforms/LoopVectorize/X86/vectorization-remarks.ll b/test/Transforms/LoopVectorize/X86/vectorization-remarks.ll index 14e541a..16fe370 100644 --- a/test/Transforms/LoopVectorize/X86/vectorization-remarks.ll +++ b/test/Transforms/LoopVectorize/X86/vectorization-remarks.ll @@ -49,26 +49,26 @@ declare void @ibar(i32*) #1 !llvm.module.flags = !{!7, !8} !llvm.ident = !{!9} -!1 = metadata !{metadata !"vectorization-remarks.c", metadata !"."} -!2 = metadata !{} -!3 = metadata !{metadata !4} -!4 = metadata !{metadata !"0x2e\00foo\00foo\00\005\000\001\000\006\00256\001\006", metadata !1, metadata !5, metadata !6, null, i32 (i32)* @foo, null, null, metadata !2} ; [ DW_TAG_subprogram ] [line 5] [def] [scope 6] [foo] -!5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] [./vectorization-remarks.c] -!6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !2, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] -!7 = metadata !{i32 2, metadata !"Dwarf Version", i32 4} -!8 = metadata !{i32 1, metadata !"Debug Info Version", i32 2} -!9 = metadata !{metadata !"clang version 3.5.0 "} -!10 = metadata !{i32 8, i32 3, metadata !4, null} -!11 = metadata !{metadata !12, metadata !12, i64 0} -!12 = metadata !{metadata !"int", metadata !13, i64 0} -!13 = metadata !{metadata !"omnipotent char", metadata !14, i64 0} -!14 = metadata !{metadata !"Simple C/C++ TBAA"} -!15 = metadata !{i32 17, i32 8, metadata !16, null} -!16 = metadata !{metadata !"0xb\0017\008\002", metadata !1, metadata !17} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] -!17 = metadata !{metadata !"0xb\0017\008\001", metadata !1, metadata !18} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] -!18 = metadata !{metadata !"0xb\0017\003\000", metadata !1, metadata !4} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] -!19 = metadata !{i32 18, i32 5, metadata !20, null} -!20 = metadata !{metadata !"0xb\0017\0027\000", metadata !1, metadata !18} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] -!21 = metadata !{metadata !13, metadata !13, i64 0} -!22 = metadata !{i32 20, i32 3, metadata !4, null} -!23 = metadata !{i32 21, i32 3, metadata !4, null} +!1 = !{!"vectorization-remarks.c", !"."} +!2 = !{} +!3 = !{!4} +!4 = !{!"0x2e\00foo\00foo\00\005\000\001\000\006\00256\001\006", !1, !5, !6, null, i32 (i32)* @foo, null, null, !2} ; [ DW_TAG_subprogram ] [line 5] [def] [scope 6] [foo] +!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [./vectorization-remarks.c] +!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !2, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] +!7 = !{i32 2, !"Dwarf Version", i32 4} +!8 = !{i32 1, !"Debug Info Version", i32 2} +!9 = !{!"clang version 3.5.0 "} +!10 = !MDLocation(line: 8, column: 3, scope: !4) +!11 = !{!12, !12, i64 0} +!12 = !{!"int", !13, i64 0} +!13 = !{!"omnipotent char", !14, i64 0} +!14 = !{!"Simple C/C++ TBAA"} +!15 = !MDLocation(line: 17, column: 8, scope: !16) +!16 = !{!"0xb\0017\008\002", !1, !17} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] +!17 = !{!"0xb\0017\008\001", !1, !18} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] +!18 = !{!"0xb\0017\003\000", !1, !4} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] +!19 = !MDLocation(line: 18, column: 5, scope: !20) +!20 = !{!"0xb\0017\0027\000", !1, !18} ; [ DW_TAG_lexical_block ] [./vectorization-remarks.c] +!21 = !{!13, !13, i64 0} +!22 = !MDLocation(line: 20, column: 3, scope: !4) +!23 = !MDLocation(line: 21, column: 3, scope: !4) diff --git a/test/Transforms/LoopVectorize/conditional-assignment.ll b/test/Transforms/LoopVectorize/conditional-assignment.ll index 50fa329..38e9c4f 100644 --- a/test/Transforms/LoopVectorize/conditional-assignment.ll +++ b/test/Transforms/LoopVectorize/conditional-assignment.ll @@ -36,23 +36,23 @@ attributes #0 = { nounwind } !llvm.module.flags = !{!7, !8} !llvm.ident = !{!9} -!0 = metadata !{metadata !"0x11\0012\00clang version 3.6.0\001\00\000\00\002", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] -!1 = metadata !{metadata !"source.c", metadata !"."} -!2 = metadata !{} -!3 = metadata !{metadata !4} -!4 = metadata !{metadata !"0x2e\00conditional_store\00conditional_store\00\001\000\001\000\006\00256\001\001", metadata !1, metadata !5, metadata !6, null, void (i32*)* @conditional_store, null, null, metadata !2} ; [ DW_TAG_subprogram ] -!5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] -!6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !2, null, null, null} ; [ DW_TAG_subroutine_type ] -!7 = metadata !{i32 2, metadata !"Dwarf Version", i32 2} -!8 = metadata !{i32 2, metadata !"Debug Info Version", i32 2} -!9 = metadata !{metadata !"clang version 3.6.0"} -!10 = metadata !{i32 2, i32 8, metadata !11, null} -!11 = metadata !{metadata !"0xb\002\003\000", metadata !1, metadata !4} ; [ DW_TAG_lexical_block ] -!12 = metadata !{i32 3, i32 9, metadata !13, null} -!13 = metadata !{metadata !"0xb\003\009\000", metadata !1, metadata !11} ; [ DW_TAG_lexical_block ] -!14 = metadata !{metadata !15, metadata !15, i64 0} -!15 = metadata !{metadata !"int", metadata !16, i64 0} -!16 = metadata !{metadata !"omnipotent char", metadata !17, i64 0} -!17 = metadata !{metadata !"Simple C/C++ TBAA"} -!18 = metadata !{i32 3, i32 29, metadata !13, null} -!19 = metadata !{i32 4, i32 1, metadata !4, null} +!0 = !{!"0x11\0012\00clang version 3.6.0\001\00\000\00\002", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] +!1 = !{!"source.c", !"."} +!2 = !{} +!3 = !{!4} +!4 = !{!"0x2e\00conditional_store\00conditional_store\00\001\000\001\000\006\00256\001\001", !1, !5, !6, null, void (i32*)* @conditional_store, null, null, !2} ; [ DW_TAG_subprogram ] +!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] +!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !2, null, null, null} ; [ DW_TAG_subroutine_type ] +!7 = !{i32 2, !"Dwarf Version", i32 2} +!8 = !{i32 2, !"Debug Info Version", i32 2} +!9 = !{!"clang version 3.6.0"} +!10 = !MDLocation(line: 2, column: 8, scope: !11) +!11 = !{!"0xb\002\003\000", !1, !4} ; [ DW_TAG_lexical_block ] +!12 = !MDLocation(line: 3, column: 9, scope: !13) +!13 = !{!"0xb\003\009\000", !1, !11} ; [ DW_TAG_lexical_block ] +!14 = !{!15, !15, i64 0} +!15 = !{!"int", !16, i64 0} +!16 = !{!"omnipotent char", !17, i64 0} +!17 = !{!"Simple C/C++ TBAA"} +!18 = !MDLocation(line: 3, column: 29, scope: !13) +!19 = !MDLocation(line: 4, column: 1, scope: !4) diff --git a/test/Transforms/LoopVectorize/control-flow.ll b/test/Transforms/LoopVectorize/control-flow.ll index 452b7ae..1882c3f 100644 --- a/test/Transforms/LoopVectorize/control-flow.ll +++ b/test/Transforms/LoopVectorize/control-flow.ll @@ -55,24 +55,24 @@ attributes #0 = { nounwind } !llvm.module.flags = !{!7, !8} !llvm.ident = !{!9} -!0 = metadata !{metadata !"0x11\004\00clang version 3.5.0\001\00\006\00\002", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [./source.cpp] [DW_LANG_C_plus_plus] -!1 = metadata !{metadata !"source.cpp", metadata !"."} -!2 = metadata !{} -!3 = metadata !{metadata !4} -!4 = metadata !{metadata !"0x2e\00test\00test\00\001\000\001\000\006\00256\001\002", metadata !1, metadata !5, metadata !6, null, i32 (i32*, i32)* @_Z4testPii, null, null, metadata !2} ; [ DW_TAG_subprogram ] [line 1] [def] [scope 2] [test] -!5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] [./source.cpp] -!6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !2, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] -!7 = metadata !{i32 2, metadata !"Dwarf Version", i32 2} -!8 = metadata !{i32 2, metadata !"Debug Info Version", i32 2} -!9 = metadata !{metadata !"clang version 3.5.0"} -!10 = metadata !{i32 3, i32 8, metadata !11, null} -!11 = metadata !{metadata !"0xb\003\003\000", metadata !1, metadata !4} ; [ DW_TAG_lexical_block ] -!12 = metadata !{i32 5, i32 9, metadata !13, null} -!13 = metadata !{metadata !"0xb\005\009\000", metadata !1, metadata !14} ; [ DW_TAG_lexical_block ] -!14 = metadata !{metadata !"0xb\004\003\000", metadata !1, metadata !11} ; [ DW_TAG_lexical_block ] -!15 = metadata !{metadata !16, metadata !16, i64 0} -!16 = metadata !{metadata !"int", metadata !17, i64 0} -!17 = metadata !{metadata !"omnipotent char", metadata !18, i64 0} -!18 = metadata !{metadata !"Simple C/C++ TBAA"} -!19 = metadata !{i32 8, i32 7, metadata !13, null} -!20 = metadata !{i32 12, i32 3, metadata !4, null} +!0 = !{!"0x11\004\00clang version 3.5.0\001\00\006\00\002", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [./source.cpp] [DW_LANG_C_plus_plus] +!1 = !{!"source.cpp", !"."} +!2 = !{} +!3 = !{!4} +!4 = !{!"0x2e\00test\00test\00\001\000\001\000\006\00256\001\002", !1, !5, !6, null, i32 (i32*, i32)* @_Z4testPii, null, null, !2} ; [ DW_TAG_subprogram ] [line 1] [def] [scope 2] [test] +!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [./source.cpp] +!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !2, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] +!7 = !{i32 2, !"Dwarf Version", i32 2} +!8 = !{i32 2, !"Debug Info Version", i32 2} +!9 = !{!"clang version 3.5.0"} +!10 = !MDLocation(line: 3, column: 8, scope: !11) +!11 = !{!"0xb\003\003\000", !1, !4} ; [ DW_TAG_lexical_block ] +!12 = !MDLocation(line: 5, column: 9, scope: !13) +!13 = !{!"0xb\005\009\000", !1, !14} ; [ DW_TAG_lexical_block ] +!14 = !{!"0xb\004\003\000", !1, !11} ; [ DW_TAG_lexical_block ] +!15 = !{!16, !16, i64 0} +!16 = !{!"int", !17, i64 0} +!17 = !{!"omnipotent char", !18, i64 0} +!18 = !{!"Simple C/C++ TBAA"} +!19 = !MDLocation(line: 8, column: 7, scope: !13) +!20 = !MDLocation(line: 12, column: 3, scope: !4) diff --git a/test/Transforms/LoopVectorize/dbg.value.ll b/test/Transforms/LoopVectorize/dbg.value.ll index 91d07d4..92d3154 100644 --- a/test/Transforms/LoopVectorize/dbg.value.ll +++ b/test/Transforms/LoopVectorize/dbg.value.ll @@ -11,7 +11,7 @@ target triple = "x86_64-apple-macosx10.8.0" ; CHECK-LABEL: @test( define i32 @test() #0 { entry: - tail call void @llvm.dbg.value(metadata !1, i64 0, metadata !9, metadata !{}), !dbg !18 + tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !9, metadata !{}), !dbg !18 br label %for.body, !dbg !18 for.body: @@ -44,27 +44,27 @@ attributes #1 = { nounwind readnone } !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!26} -!0 = metadata !{metadata !"0x11\004\00clang\001\00\000\00\000", metadata !25, metadata !1, metadata !1, metadata !2, metadata !11, null} ; [ DW_TAG_compile_unit ] -!1 = metadata !{i32 0} -!2 = metadata !{metadata !3} -!3 = metadata !{metadata !"0x2e\00test\00test\00test\005\000\001\000\006\00256\001\005", metadata !25, metadata !4, metadata !5, null, i32 ()* @test, null, null, metadata !8} ; [ DW_TAG_subprogram ] -!4 = metadata !{metadata !"0x29", metadata !25} ; [ DW_TAG_file_type ] -!5 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !6, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] -!6 = metadata !{metadata !7} -!7 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] -!8 = metadata !{metadata !9} -!9 = metadata !{metadata !"0x100\00i\006\000", metadata !10, metadata !4, metadata !7} ; [ DW_TAG_auto_variable ] -!10 = metadata !{metadata !"0xb\006\000\000", metadata !25, metadata !3} ; [ DW_TAG_lexical_block ] -!11 = metadata !{metadata !12, metadata !16, metadata !17} -!12 = metadata !{metadata !"0x34\00A\00A\00\001\000\001", null, metadata !4, metadata !13, [1024 x i32]* @A, null} ; [ DW_TAG_variable ] -!13 = metadata !{metadata !"0x1\00\000\0032768\0032\000\000", null, null, metadata !7, metadata !14, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 32768, align 32, offset 0] [from int] -!14 = metadata !{metadata !15} -!15 = metadata !{i32 786465, i64 0, i64 1024} -!16 = metadata !{metadata !"0x34\00B\00B\00\002\000\001", null, metadata !4, metadata !13, [1024 x i32]* @B, null} ; [ DW_TAG_variable ] -!17 = metadata !{metadata !"0x34\00C\00C\00\003\000\001", null, metadata !4, metadata !13, [1024 x i32]* @C, null} ; [ DW_TAG_variable ] -!18 = metadata !{i32 6, i32 0, metadata !10, null} -!19 = metadata !{i32 7, i32 0, metadata !20, null} -!20 = metadata !{metadata !"0xb\006\000\001", metadata !25, metadata !10} ; [ DW_TAG_lexical_block ] -!24 = metadata !{i32 9, i32 0, metadata !3, null} -!25 = metadata !{metadata !"test", metadata !"/path/to/somewhere"} -!26 = metadata !{i32 1, metadata !"Debug Info Version", i32 2} +!0 = !{!"0x11\004\00clang\001\00\000\00\000", !25, !1, !1, !2, !11, null} ; [ DW_TAG_compile_unit ] +!1 = !{i32 0} +!2 = !{!3} +!3 = !{!"0x2e\00test\00test\00test\005\000\001\000\006\00256\001\005", !25, !4, !5, null, i32 ()* @test, null, null, !8} ; [ DW_TAG_subprogram ] +!4 = !{!"0x29", !25} ; [ DW_TAG_file_type ] +!5 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !6, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] +!6 = !{!7} +!7 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] +!8 = !{!9} +!9 = !{!"0x100\00i\006\000", !10, !4, !7} ; [ DW_TAG_auto_variable ] +!10 = !{!"0xb\006\000\000", !25, !3} ; [ DW_TAG_lexical_block ] +!11 = !{!12, !16, !17} +!12 = !{!"0x34\00A\00A\00\001\000\001", null, !4, !13, [1024 x i32]* @A, null} ; [ DW_TAG_variable ] +!13 = !{!"0x1\00\000\0032768\0032\000\000", null, null, !7, !14, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 32768, align 32, offset 0] [from int] +!14 = !{!15} +!15 = !{i32 786465, i64 0, i64 1024} +!16 = !{!"0x34\00B\00B\00\002\000\001", null, !4, !13, [1024 x i32]* @B, null} ; [ DW_TAG_variable ] +!17 = !{!"0x34\00C\00C\00\003\000\001", null, !4, !13, [1024 x i32]* @C, null} ; [ DW_TAG_variable ] +!18 = !MDLocation(line: 6, scope: !10) +!19 = !MDLocation(line: 7, scope: !20) +!20 = !{!"0xb\006\000\001", !25, !10} ; [ DW_TAG_lexical_block ] +!24 = !MDLocation(line: 9, scope: !3) +!25 = !{!"test", !"/path/to/somewhere"} +!26 = !{i32 1, !"Debug Info Version", i32 2} diff --git a/test/Transforms/LoopVectorize/debugloc.ll b/test/Transforms/LoopVectorize/debugloc.ll index 6350296..634bf79 100644 --- a/test/Transforms/LoopVectorize/debugloc.ll +++ b/test/Transforms/LoopVectorize/debugloc.ll @@ -19,10 +19,10 @@ target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f3 define i32 @f(i32* nocapture %a, i32 %size) #0 { entry: - tail call void @llvm.dbg.value(metadata !{i32* %a}, i64 0, metadata !13, metadata !{}), !dbg !19 - tail call void @llvm.dbg.value(metadata !{i32 %size}, i64 0, metadata !14, metadata !{}), !dbg !19 - tail call void @llvm.dbg.value(metadata !2, i64 0, metadata !15, metadata !{}), !dbg !20 - tail call void @llvm.dbg.value(metadata !2, i64 0, metadata !16, metadata !{}), !dbg !21 + tail call void @llvm.dbg.value(metadata i32* %a, i64 0, metadata !13, metadata !{}), !dbg !19 + tail call void @llvm.dbg.value(metadata i32 %size, i64 0, metadata !14, metadata !{}), !dbg !19 + tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !15, metadata !{}), !dbg !20 + tail call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !16, metadata !{}), !dbg !21 %cmp4 = icmp eq i32 %size, 0, !dbg !21 br i1 %cmp4, label %for.end, label %for.body.lr.ph, !dbg !21 @@ -35,7 +35,7 @@ for.body: ; preds = %for.body.lr.ph, %fo %arrayidx = getelementptr inbounds i32* %a, i64 %indvars.iv, !dbg !22 %0 = load i32* %arrayidx, align 4, !dbg !22 %add = add i32 %0, %sum.05, !dbg !22 - tail call void @llvm.dbg.value(metadata !{i32 %add.lcssa}, i64 0, metadata !15, metadata !{}), !dbg !22 + tail call void @llvm.dbg.value(metadata i32 %add.lcssa, i64 0, metadata !15, metadata !{}), !dbg !22 %indvars.iv.next = add i64 %indvars.iv, 1, !dbg !21 tail call void @llvm.dbg.value(metadata !{null}, i64 0, metadata !16, metadata !{}), !dbg !21 %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !21 @@ -63,28 +63,28 @@ attributes #1 = { nounwind readnone } !llvm.dbg.cu = !{!0} !llvm.module.flags = !{!18, !27} -!0 = metadata !{metadata !"0x11\0012\00clang version 3.4 (trunk 185038) (llvm/trunk 185097)\001\00\000\00\000", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [/Volumes/Data/backedup/dev/os/llvm/debug/-] [DW_LANG_C99] -!1 = metadata !{metadata !"-", metadata !"/Volumes/Data/backedup/dev/os/llvm/debug"} -!2 = metadata !{i32 0} -!3 = metadata !{metadata !4} -!4 = metadata !{metadata !"0x2e\00f\00f\00\003\000\001\000\006\00256\001\003", metadata !5, metadata !6, metadata !7, null, i32 (i32*, i32)* @f, null, null, metadata !12} ; [ DW_TAG_subprogram ] [line 3] [def] [f] -!5 = metadata !{metadata !"<stdin>", metadata !"/Volumes/Data/backedup/dev/os/llvm/debug"} -!6 = metadata !{metadata !"0x29", metadata !5} ; [ DW_TAG_file_type ] [/Volumes/Data/backedup/dev/os/llvm/debug/<stdin>] -!7 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] -!8 = metadata !{metadata !9, metadata !10, metadata !11} -!9 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] -!10 = metadata !{metadata !"0xf\00\000\0064\0064\000\000", null, null, metadata !9} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int] -!11 = metadata !{metadata !"0x24\00unsigned int\000\0032\0032\000\000\007", null, null} ; [ DW_TAG_base_type ] [unsigned int] [line 0, size 32, align 32, offset 0, enc DW_ATE_unsigned] -!12 = metadata !{metadata !13, metadata !14, metadata !15, metadata !16} -!13 = metadata !{metadata !"0x101\00a\0016777219\000", metadata !4, metadata !6, metadata !10} ; [ DW_TAG_arg_variable ] [a] [line 3] -!14 = metadata !{metadata !"0x101\00size\0033554435\000", metadata !4, metadata !6, metadata !11} ; [ DW_TAG_arg_variable ] [size] [line 3] -!15 = metadata !{metadata !"0x100\00sum\004\000", metadata !4, metadata !6, metadata !11} ; [ DW_TAG_auto_variable ] [sum] [line 4] -!16 = metadata !{metadata !"0x100\00i\005\000", metadata !17, metadata !6, metadata !11} ; [ DW_TAG_auto_variable ] [i] [line 5] -!17 = metadata !{metadata !"0xb\005\000\000", metadata !5, metadata !4} ; [ DW_TAG_lexical_block ] [/Volumes/Data/backedup/dev/os/llvm/debug/<stdin>] -!18 = metadata !{i32 2, metadata !"Dwarf Version", i32 3} -!19 = metadata !{i32 3, i32 0, metadata !4, null} -!20 = metadata !{i32 4, i32 0, metadata !4, null} -!21 = metadata !{i32 5, i32 0, metadata !17, null} -!22 = metadata !{i32 6, i32 0, metadata !17, null} -!26 = metadata !{i32 7, i32 0, metadata !4, null} -!27 = metadata !{i32 1, metadata !"Debug Info Version", i32 2} +!0 = !{!"0x11\0012\00clang version 3.4 (trunk 185038) (llvm/trunk 185097)\001\00\000\00\000", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/Volumes/Data/backedup/dev/os/llvm/debug/-] [DW_LANG_C99] +!1 = !{!"-", !"/Volumes/Data/backedup/dev/os/llvm/debug"} +!2 = !{i32 0} +!3 = !{!4} +!4 = !{!"0x2e\00f\00f\00\003\000\001\000\006\00256\001\003", !5, !6, !7, null, i32 (i32*, i32)* @f, null, null, !12} ; [ DW_TAG_subprogram ] [line 3] [def] [f] +!5 = !{!"<stdin>", !"/Volumes/Data/backedup/dev/os/llvm/debug"} +!6 = !{!"0x29", !5} ; [ DW_TAG_file_type ] [/Volumes/Data/backedup/dev/os/llvm/debug/<stdin>] +!7 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] +!8 = !{!9, !10, !11} +!9 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed] +!10 = !{!"0xf\00\000\0064\0064\000\000", null, null, !9} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int] +!11 = !{!"0x24\00unsigned int\000\0032\0032\000\000\007", null, null} ; [ DW_TAG_base_type ] [unsigned int] [line 0, size 32, align 32, offset 0, enc DW_ATE_unsigned] +!12 = !{!13, !14, !15, !16} +!13 = !{!"0x101\00a\0016777219\000", !4, !6, !10} ; [ DW_TAG_arg_variable ] [a] [line 3] +!14 = !{!"0x101\00size\0033554435\000", !4, !6, !11} ; [ DW_TAG_arg_variable ] [size] [line 3] +!15 = !{!"0x100\00sum\004\000", !4, !6, !11} ; [ DW_TAG_auto_variable ] [sum] [line 4] +!16 = !{!"0x100\00i\005\000", !17, !6, !11} ; [ DW_TAG_auto_variable ] [i] [line 5] +!17 = !{!"0xb\005\000\000", !5, !4} ; [ DW_TAG_lexical_block ] [/Volumes/Data/backedup/dev/os/llvm/debug/<stdin>] +!18 = !{i32 2, !"Dwarf Version", i32 3} +!19 = !MDLocation(line: 3, scope: !4) +!20 = !MDLocation(line: 4, scope: !4) +!21 = !MDLocation(line: 5, scope: !17) +!22 = !MDLocation(line: 6, scope: !17) +!26 = !MDLocation(line: 7, scope: !4) +!27 = !{i32 1, !"Debug Info Version", i32 2} diff --git a/test/Transforms/LoopVectorize/duplicated-metadata.ll b/test/Transforms/LoopVectorize/duplicated-metadata.ll index 8353dca..bf2f899 100644 --- a/test/Transforms/LoopVectorize/duplicated-metadata.ll +++ b/test/Transforms/LoopVectorize/duplicated-metadata.ll @@ -24,7 +24,7 @@ for.end: ; preds = %for.body ret void } -!0 = metadata !{metadata !0, metadata !1} -!1 = metadata !{metadata !"llvm.loop.vectorize.width", i32 4} +!0 = !{!0, !1} +!1 = !{!"llvm.loop.vectorize.width", i32 4} ; CHECK-NOT: !{metadata !"llvm.loop.vectorize.width", i32 4} -; CHECK: !{metadata !"llvm.loop.interleave.count", i32 1} +; CHECK: !{!"llvm.loop.interleave.count", i32 1} diff --git a/test/Transforms/LoopVectorize/gcc-examples.ll b/test/Transforms/LoopVectorize/gcc-examples.ll index 6c8af0b..6a2c2c6 100644 --- a/test/Transforms/LoopVectorize/gcc-examples.ll +++ b/test/Transforms/LoopVectorize/gcc-examples.ll @@ -388,9 +388,8 @@ define void @example12() nounwind uwtable ssp { ret void } -; Can't vectorize because of reductions. ;CHECK-LABEL: @example13( -;CHECK-NOT: <4 x i32> +;CHECK: <4 x i32> ;CHECK: ret void define void @example13(i32** nocapture %A, i32** nocapture %B, i32* nocapture %out) nounwind uwtable ssp { br label %.preheader diff --git a/test/Transforms/LoopVectorize/if-conversion-edgemasks.ll b/test/Transforms/LoopVectorize/if-conversion-edgemasks.ll index 27c274d..8b8408b 100644 --- a/test/Transforms/LoopVectorize/if-conversion-edgemasks.ll +++ b/test/Transforms/LoopVectorize/if-conversion-edgemasks.ll @@ -20,7 +20,10 @@ entry: br i1 %cmp88, label %for.body.lr.ph, label %for.end for.body.lr.ph: - %0 = load i32** @b, align 8 %1 = load i32** @a, align 8 %2 = load i32** @c, align 8 br label %for.body + %0 = load i32** @b, align 8 + %1 = load i32** @a, align 8 + %2 = load i32** @c, align 8 + br label %for.body for.body: %indvars.iv = phi i64 [ 0, %for.body.lr.ph ], [ %indvars.iv.next, %_ZL3fn3ii.exit58 ] diff --git a/test/Transforms/LoopVectorize/if-conversion.ll b/test/Transforms/LoopVectorize/if-conversion.ll index 9e18528..a220203 100644 --- a/test/Transforms/LoopVectorize/if-conversion.ll +++ b/test/Transforms/LoopVectorize/if-conversion.ll @@ -19,9 +19,9 @@ target triple = "x86_64-apple-macosx10.9.0" ;CHECK-LABEL: @function0( ;CHECK: load <4 x i32> -;CHECK: icmp sgt <4 x i32> ;CHECK: mul <4 x i32> ;CHECK: add <4 x i32> +;CHECK: icmp sle <4 x i32> ;CHECK: select <4 x i1> ;CHECK: ret i32 define i32 @function0(i32* nocapture %a, i32* nocapture %b, i32 %start, i32 %end) nounwind uwtable ssp { @@ -72,8 +72,8 @@ for.end: ;CHECK-LABEL: @reduction_func( ;CHECK: load <4 x i32> -;CHECK: icmp sgt <4 x i32> ;CHECK: add <4 x i32> +;CHECK: icmp sle <4 x i32> ;CHECK: select <4 x i1> ;CHECK: ret i32 define i32 @reduction_func(i32* nocapture %A, i32 %n) nounwind uwtable readonly ssp { diff --git a/test/Transforms/LoopVectorize/incorrect-dom-info.ll b/test/Transforms/LoopVectorize/incorrect-dom-info.ll index 624ee7e..b8624fd 100644 --- a/test/Transforms/LoopVectorize/incorrect-dom-info.ll +++ b/test/Transforms/LoopVectorize/incorrect-dom-info.ll @@ -139,4 +139,4 @@ attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-po !llvm.ident = !{!0} -!0 = metadata !{metadata !"clang version 3.6.0 "} +!0 = !{!"clang version 3.6.0 "} diff --git a/test/Transforms/LoopVectorize/loop-form.ll b/test/Transforms/LoopVectorize/loop-form.ll new file mode 100644 index 0000000..138df1d --- /dev/null +++ b/test/Transforms/LoopVectorize/loop-form.ll @@ -0,0 +1,31 @@ +; RUN: opt -S -loop-vectorize < %s | FileCheck %s +target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" + +; Check that we vectorize only bottom-tested loops. +; This is a reduced testcase from PR21302. +; +; rdar://problem/18886083 + +%struct.X = type { i32, i16 } +; CHECK-LABEL: @foo( +; CHECK-NOT: vector.body + +define void @foo(i32 %n) { +entry: + br label %for.cond + +for.cond: + %i = phi i32 [ 0, %entry ], [ %inc, %for.body ] + %cmp = icmp slt i32 %i, %n + br i1 %cmp, label %for.body, label %if.end + +for.body: + %iprom = sext i32 %i to i64 + %b = getelementptr inbounds %struct.X* undef, i64 %iprom, i32 1 + store i16 0, i16* %b, align 4 + %inc = add nsw i32 %i, 1 + br label %for.cond + +if.end: + ret void +} diff --git a/test/Transforms/LoopVectorize/loop-vect-memdep.ll b/test/Transforms/LoopVectorize/loop-vect-memdep.ll new file mode 100644 index 0000000..e2c7524 --- /dev/null +++ b/test/Transforms/LoopVectorize/loop-vect-memdep.ll @@ -0,0 +1,26 @@ +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" + +; RUN: opt < %s -S -loop-vectorize -debug-only=loop-vectorize 2>&1 | FileCheck %s +; REQUIRES: asserts +; CHECK: LV: Can't vectorize due to memory conflicts + +define void @test_loop_novect(double** %arr, i64 %n) { +for.body.lr.ph: + %t = load double** %arr, align 8 + br label %for.body + +for.body: ; preds = %for.body, %for.body.lr.ph + %i = phi i64 [ 0, %for.body.lr.ph ], [ %i.next, %for.body ] + %a = getelementptr inbounds double* %t, i64 %i + %i.next = add nuw nsw i64 %i, 1 + %a.next = getelementptr inbounds double* %t, i64 %i.next + %t1 = load double* %a, align 8 + %t2 = load double* %a.next, align 8 + store double %t1, double* %a.next, align 8 + store double %t2, double* %a, align 8 + %c = icmp eq i64 %i, %n + br i1 %c, label %final, label %for.body + +final: ; preds = %for.body + ret void +} diff --git a/test/Transforms/LoopVectorize/metadata-unroll.ll b/test/Transforms/LoopVectorize/metadata-unroll.ll index 848f1f9..36a2314 100644 --- a/test/Transforms/LoopVectorize/metadata-unroll.ll +++ b/test/Transforms/LoopVectorize/metadata-unroll.ll @@ -37,5 +37,5 @@ define void @inc(i32 %n) nounwind uwtable noinline ssp { ret void } -!0 = metadata !{metadata !0, metadata !1} -!1 = metadata !{metadata !"llvm.loop.interleave.count", i32 2} +!0 = !{!0, !1} +!1 = !{!"llvm.loop.interleave.count", i32 2} diff --git a/test/Transforms/LoopVectorize/metadata-width.ll b/test/Transforms/LoopVectorize/metadata-width.ll index da0c622..dee4fee 100644 --- a/test/Transforms/LoopVectorize/metadata-width.ll +++ b/test/Transforms/LoopVectorize/metadata-width.ll @@ -27,5 +27,5 @@ for.end: ; preds = %for.body, %entry attributes #0 = { nounwind uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -!0 = metadata !{metadata !0, metadata !1} -!1 = metadata !{metadata !"llvm.loop.vectorize.width", i32 8} +!0 = !{!0, !1} +!1 = !{!"llvm.loop.vectorize.width", i32 8} diff --git a/test/Transforms/LoopVectorize/metadata.ll b/test/Transforms/LoopVectorize/metadata.ll index 14f60b3..a258f7c 100644 --- a/test/Transforms/LoopVectorize/metadata.ll +++ b/test/Transforms/LoopVectorize/metadata.ll @@ -27,18 +27,18 @@ for.end: ; preds = %for.body ; CHECK: store <4 x i32> %{{.*}}, <4 x i32>* %{{.*}}, align 4, !tbaa ![[TINT:[0-9]+]] ; CHECK: ret i32 0 -; CHECK-DAG: ![[TFLT]] = metadata !{metadata ![[TFLT1:[0-9]+]] -; CHECK-DAG: ![[TFLT1]] = metadata !{metadata !"float" +; CHECK-DAG: ![[TFLT]] = !{![[TFLT1:[0-9]+]] +; CHECK-DAG: ![[TFLT1]] = !{!"float" -; CHECK-DAG: ![[TINT]] = metadata !{metadata ![[TINT1:[0-9]+]] -; CHECK-DAG: ![[TINT1]] = metadata !{metadata !"int" +; CHECK-DAG: ![[TINT]] = !{![[TINT1:[0-9]+]] +; CHECK-DAG: ![[TINT1]] = !{!"int" attributes #0 = { nounwind uwtable } -!0 = metadata !{metadata !1, metadata !1, i64 0} -!1 = metadata !{metadata !"float", metadata !2, i64 0} -!2 = metadata !{metadata !"omnipotent char", metadata !3, i64 0} -!3 = metadata !{metadata !"Simple C/C++ TBAA"} -!4 = metadata !{metadata !5, metadata !5, i64 0} -!5 = metadata !{metadata !"int", metadata !2, i64 0} +!0 = !{!1, !1, i64 0} +!1 = !{!"float", !2, i64 0} +!2 = !{!"omnipotent char", !3, i64 0} +!3 = !{!"Simple C/C++ TBAA"} +!4 = !{!5, !5, i64 0} +!5 = !{!"int", !2, i64 0} diff --git a/test/Transforms/LoopVectorize/minmax_reduction.ll b/test/Transforms/LoopVectorize/minmax_reduction.ll index e73e69d..1984cdd 100644 --- a/test/Transforms/LoopVectorize/minmax_reduction.ll +++ b/test/Transforms/LoopVectorize/minmax_reduction.ll @@ -516,7 +516,7 @@ for.end: } ; CHECK-LABEL: @unordered_max_red_float( -; CHECK: fcmp ugt <2 x float> +; CHECK: fcmp ole <2 x float> ; CHECK: select <2 x i1> ; CHECK: middle.block ; CHECK: fcmp ogt <2 x float> @@ -542,7 +542,7 @@ for.end: } ; CHECK-LABEL: @unordered_max_red_float_ge( -; CHECK: fcmp uge <2 x float> +; CHECK: fcmp olt <2 x float> ; CHECK: select <2 x i1> ; CHECK: middle.block ; CHECK: fcmp ogt <2 x float> @@ -568,7 +568,7 @@ for.end: } ; CHECK-LABEL: @inverted_unordered_max_red_float( -; CHECK: fcmp ult <2 x float> +; CHECK: fcmp oge <2 x float> ; CHECK: select <2 x i1> ; CHECK: middle.block ; CHECK: fcmp ogt <2 x float> @@ -594,7 +594,7 @@ for.end: } ; CHECK-LABEL: @inverted_unordered_max_red_float_le( -; CHECK: fcmp ule <2 x float> +; CHECK: fcmp ogt <2 x float> ; CHECK: select <2 x i1> ; CHECK: middle.block ; CHECK: fcmp ogt <2 x float> @@ -727,7 +727,7 @@ for.end: } ; CHECK-LABEL: @unordered_min_red_float( -; CHECK: fcmp ult <2 x float> +; CHECK: fcmp oge <2 x float> ; CHECK: select <2 x i1> ; CHECK: middle.block ; CHECK: fcmp olt <2 x float> @@ -753,7 +753,7 @@ for.end: } ; CHECK-LABEL: @unordered_min_red_float_le( -; CHECK: fcmp ule <2 x float> +; CHECK: fcmp ogt <2 x float> ; CHECK: select <2 x i1> ; CHECK: middle.block ; CHECK: fcmp olt <2 x float> @@ -779,7 +779,7 @@ for.end: } ; CHECK-LABEL: @inverted_unordered_min_red_float( -; CHECK: fcmp ugt <2 x float> +; CHECK: fcmp ole <2 x float> ; CHECK: select <2 x i1> ; CHECK: middle.block ; CHECK: fcmp olt <2 x float> @@ -805,7 +805,7 @@ for.end: } ; CHECK-LABEL: @inverted_unordered_min_red_float_ge( -; CHECK: fcmp uge <2 x float> +; CHECK: fcmp olt <2 x float> ; CHECK: select <2 x i1> ; CHECK: middle.block ; CHECK: fcmp olt <2 x float> diff --git a/test/Transforms/LoopVectorize/no_array_bounds.ll b/test/Transforms/LoopVectorize/no_array_bounds.ll index a39b44f..d3bd755 100644 --- a/test/Transforms/LoopVectorize/no_array_bounds.ll +++ b/test/Transforms/LoopVectorize/no_array_bounds.ll @@ -72,30 +72,30 @@ attributes #0 = { nounwind } !llvm.module.flags = !{!7, !8} !llvm.ident = !{!9} -!0 = metadata !{metadata !"0x11\004\00clang version 3.5.0\001\00\000\00\002", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] -!1 = metadata !{metadata !"no_array_bounds.cpp", metadata !"."} -!2 = metadata !{} -!3 = metadata !{metadata !4} -!4 = metadata !{metadata !"0x2e\00test\00test\00\001\000\001\000\006\00256\001\002", metadata !1, metadata !5, metadata !6, null, void (i32*, i32*, i32)* @_Z4testPiS_i, null, null, metadata !2} ; [ DW_TAG_subprogram ] -!5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] -!6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !2, null, null, null} ; [ DW_TAG_subroutine_type ] -!7 = metadata !{i32 2, metadata !"Dwarf Version", i32 2} -!8 = metadata !{i32 2, metadata !"Debug Info Version", i32 2} -!9 = metadata !{metadata !"clang version 3.5.0"} -!10 = metadata !{i32 4, i32 8, metadata !11, null} -!11 = metadata !{metadata !"0xb\004\003\000", metadata !1, metadata !4} ; [ DW_TAG_lexical_block ] -!12 = metadata !{metadata !12, metadata !13} -!13 = metadata !{metadata !"llvm.loop.vectorize.enable", i1 true} -!14 = metadata !{i32 5, i32 5, metadata !15, null} -!15 = metadata !{metadata !"0xb\004\0036\000", metadata !1, metadata !11} ; [ DW_TAG_lexical_block ] -!16 = metadata !{i32 9, i32 8, metadata !17, null} -!17 = metadata !{metadata !"0xb\009\003\000", metadata !1, metadata !4} ; [ DW_TAG_lexical_block ] -!18 = metadata !{metadata !18, metadata !13, metadata !19} -!19 = metadata !{metadata !"llvm.loop.vectorize.width", i32 1} -!20 = metadata !{i32 10, i32 5, metadata !21, null} -!21 = metadata !{metadata !"0xb\009\0036\000", metadata !1, metadata !17} ; [ DW_TAG_lexical_block ] -!22 = metadata !{metadata !23, metadata !23, i64 0} -!23 = metadata !{metadata !"int", metadata !24, i64 0} -!24 = metadata !{metadata !"omnipotent char", metadata !25, i64 0} -!25 = metadata !{metadata !"Simple C/C++ TBAA"} -!26 = metadata !{i32 12, i32 1, metadata !4, null} +!0 = !{!"0x11\004\00clang version 3.5.0\001\00\000\00\002", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] +!1 = !{!"no_array_bounds.cpp", !"."} +!2 = !{} +!3 = !{!4} +!4 = !{!"0x2e\00test\00test\00\001\000\001\000\006\00256\001\002", !1, !5, !6, null, void (i32*, i32*, i32)* @_Z4testPiS_i, null, null, !2} ; [ DW_TAG_subprogram ] +!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] +!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !2, null, null, null} ; [ DW_TAG_subroutine_type ] +!7 = !{i32 2, !"Dwarf Version", i32 2} +!8 = !{i32 2, !"Debug Info Version", i32 2} +!9 = !{!"clang version 3.5.0"} +!10 = !MDLocation(line: 4, column: 8, scope: !11) +!11 = !{!"0xb\004\003\000", !1, !4} ; [ DW_TAG_lexical_block ] +!12 = !{!12, !13} +!13 = !{!"llvm.loop.vectorize.enable", i1 true} +!14 = !MDLocation(line: 5, column: 5, scope: !15) +!15 = !{!"0xb\004\0036\000", !1, !11} ; [ DW_TAG_lexical_block ] +!16 = !MDLocation(line: 9, column: 8, scope: !17) +!17 = !{!"0xb\009\003\000", !1, !4} ; [ DW_TAG_lexical_block ] +!18 = !{!18, !13, !19} +!19 = !{!"llvm.loop.vectorize.width", i32 1} +!20 = !MDLocation(line: 10, column: 5, scope: !21) +!21 = !{!"0xb\009\0036\000", !1, !17} ; [ DW_TAG_lexical_block ] +!22 = !{!23, !23, i64 0} +!23 = !{!"int", !24, i64 0} +!24 = !{!"omnipotent char", !25, i64 0} +!25 = !{!"Simple C/C++ TBAA"} +!26 = !MDLocation(line: 12, column: 1, scope: !4) diff --git a/test/Transforms/LoopVectorize/no_switch.ll b/test/Transforms/LoopVectorize/no_switch.ll index c989c6b..64aab37 100644 --- a/test/Transforms/LoopVectorize/no_switch.ll +++ b/test/Transforms/LoopVectorize/no_switch.ll @@ -59,28 +59,28 @@ attributes #0 = { nounwind } !llvm.module.flags = !{!7, !8} !llvm.ident = !{!9} -!0 = metadata !{metadata !"0x11\004\00clang version 3.5.0\001\00\006\00\002", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ] [./source.cpp] [DW_LANG_C_plus_plus] -!1 = metadata !{metadata !"source.cpp", metadata !"."} -!2 = metadata !{} -!3 = metadata !{metadata !4} -!4 = metadata !{metadata !"0x2e\00test_switch\00test_switch\00\001\000\001\000\006\00256\001\001", metadata !1, metadata !5, metadata !6, null, void (i32*, i32)* @_Z11test_switchPii, null, null, metadata !2} ; [ DW_TAG_subprogram ] [line 1] [def] [test_switch] -!5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] [./source.cpp] -!6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !2, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] -!7 = metadata !{i32 2, metadata !"Dwarf Version", i32 2} -!8 = metadata !{i32 2, metadata !"Debug Info Version", i32 2} -!9 = metadata !{metadata !"clang version 3.5.0"} -!10 = metadata !{i32 3, i32 8, metadata !11, null} -!11 = metadata !{metadata !"0xb\003\003\000", metadata !1, metadata !4} ; [ DW_TAG_lexical_block ] -!12 = metadata !{metadata !12, metadata !13, metadata !13} -!13 = metadata !{metadata !"llvm.loop.vectorize.enable", i1 true} -!14 = metadata !{i32 4, i32 5, metadata !15, null} -!15 = metadata !{metadata !"0xb\003\0036\000", metadata !1, metadata !11} ; [ DW_TAG_lexical_block ] -!16 = metadata !{metadata !17, metadata !17, i64 0} -!17 = metadata !{metadata !"int", metadata !18, i64 0} -!18 = metadata !{metadata !"omnipotent char", metadata !19, i64 0} -!19 = metadata !{metadata !"Simple C/C++ TBAA"} -!20 = metadata !{i32 6, i32 7, metadata !21, null} -!21 = metadata !{metadata !"0xb\004\0018\000", metadata !1, metadata !15} ; [ DW_TAG_lexical_block ] -!22 = metadata !{i32 7, i32 5, metadata !21, null} -!23 = metadata !{i32 9, i32 7, metadata !21, null} -!24 = metadata !{i32 14, i32 1, metadata !4, null} +!0 = !{!"0x11\004\00clang version 3.5.0\001\00\006\00\002", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [./source.cpp] [DW_LANG_C_plus_plus] +!1 = !{!"source.cpp", !"."} +!2 = !{} +!3 = !{!4} +!4 = !{!"0x2e\00test_switch\00test_switch\00\001\000\001\000\006\00256\001\001", !1, !5, !6, null, void (i32*, i32)* @_Z11test_switchPii, null, null, !2} ; [ DW_TAG_subprogram ] [line 1] [def] [test_switch] +!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [./source.cpp] +!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !2, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] +!7 = !{i32 2, !"Dwarf Version", i32 2} +!8 = !{i32 2, !"Debug Info Version", i32 2} +!9 = !{!"clang version 3.5.0"} +!10 = !MDLocation(line: 3, column: 8, scope: !11) +!11 = !{!"0xb\003\003\000", !1, !4} ; [ DW_TAG_lexical_block ] +!12 = !{!12, !13, !13} +!13 = !{!"llvm.loop.vectorize.enable", i1 true} +!14 = !MDLocation(line: 4, column: 5, scope: !15) +!15 = !{!"0xb\003\0036\000", !1, !11} ; [ DW_TAG_lexical_block ] +!16 = !{!17, !17, i64 0} +!17 = !{!"int", !18, i64 0} +!18 = !{!"omnipotent char", !19, i64 0} +!19 = !{!"Simple C/C++ TBAA"} +!20 = !MDLocation(line: 6, column: 7, scope: !21) +!21 = !{!"0xb\004\0018\000", !1, !15} ; [ DW_TAG_lexical_block ] +!22 = !MDLocation(line: 7, column: 5, scope: !21) +!23 = !MDLocation(line: 9, column: 7, scope: !21) +!24 = !MDLocation(line: 14, column: 1, scope: !4) diff --git a/test/Transforms/LoopVectorize/reverse_induction.ll b/test/Transforms/LoopVectorize/reverse_induction.ll index da02d01..d379606 100644 --- a/test/Transforms/LoopVectorize/reverse_induction.ll +++ b/test/Transforms/LoopVectorize/reverse_induction.ll @@ -97,7 +97,7 @@ loopend: ; CHECK: vector.body ; CHECK: %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ] ; CHECK: %normalized.idx = sub i64 %index, 0 -; CHECK: %reverse.idx = sub i64 1023, %normalized.idx +; CHECK: %offset.idx = sub i64 1023, %normalized.idx ; CHECK: trunc i64 %index to i8 define void @reverse_forward_induction_i64_i8() { @@ -124,7 +124,7 @@ while.end: ; CHECK: vector.body: ; CHECK: %index = phi i64 [ 129, %vector.ph ], [ %index.next, %vector.body ] ; CHECK: %normalized.idx = sub i64 %index, 129 -; CHECK: %reverse.idx = sub i64 1023, %normalized.idx +; CHECK: %offset.idx = sub i64 1023, %normalized.idx ; CHECK: trunc i64 %index to i8 define void @reverse_forward_induction_i64_i8_signed() { diff --git a/test/Transforms/LoopVectorize/runtime-check-address-space.ll b/test/Transforms/LoopVectorize/runtime-check-address-space.ll index 34bbe52..ec56f80 100644 --- a/test/Transforms/LoopVectorize/runtime-check-address-space.ll +++ b/test/Transforms/LoopVectorize/runtime-check-address-space.ll @@ -31,25 +31,23 @@ define void @foo(i32 addrspace(1)* %a, i32 addrspace(1)* %b, i32 %n) #0 { ; CHECK: ret entry: - br label %for.cond + %cmp1 = icmp slt i32 0, %n + br i1 %cmp1, label %for.body, label %for.end -for.cond: ; preds = %for.body, %entry - %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.body, label %for.end - -for.body: ; preds = %for.cond - %idxprom = sext i32 %i.0 to i64 +for.body: ; preds = %entry, %for.body + %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] + %idxprom = sext i32 %i.02 to i64 %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom %0 = load i32 addrspace(1)* %arrayidx, align 4 %mul = mul nsw i32 %0, 3 - %idxprom1 = sext i32 %i.0 to i64 + %idxprom1 = sext i32 %i.02 to i64 %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %idxprom1 store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 - %inc = add nsw i32 %i.0, 1 - br label %for.cond + %inc = add nsw i32 %i.02, 1 + %cmp = icmp slt i32 %inc, %n + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body, %entry ret void } @@ -60,25 +58,23 @@ define void @bar0(i32* %a, i32 addrspace(1)* %b, i32 %n) #0 { ; CHECK: ret entry: - br label %for.cond + %cmp1 = icmp slt i32 0, %n + br i1 %cmp1, label %for.body, label %for.end -for.cond: ; preds = %for.body, %entry - %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.body, label %for.end - -for.body: ; preds = %for.cond - %idxprom = sext i32 %i.0 to i64 +for.body: ; preds = %entry, %for.body + %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] + %idxprom = sext i32 %i.02 to i64 %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom %0 = load i32 addrspace(1)* %arrayidx, align 4 %mul = mul nsw i32 %0, 3 - %idxprom1 = sext i32 %i.0 to i64 + %idxprom1 = sext i32 %i.02 to i64 %arrayidx2 = getelementptr inbounds i32* %a, i64 %idxprom1 store i32 %mul, i32* %arrayidx2, align 4 - %inc = add nsw i32 %i.0, 1 - br label %for.cond + %inc = add nsw i32 %i.02, 1 + %cmp = icmp slt i32 %inc, %n + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body, %entry ret void } @@ -89,25 +85,23 @@ define void @bar1(i32 addrspace(1)* %a, i32* %b, i32 %n) #0 { ; CHECK: ret entry: - br label %for.cond + %cmp1 = icmp slt i32 0, %n + br i1 %cmp1, label %for.body, label %for.end -for.cond: ; preds = %for.body, %entry - %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.body, label %for.end - -for.body: ; preds = %for.cond - %idxprom = sext i32 %i.0 to i64 +for.body: ; preds = %entry, %for.body + %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] + %idxprom = sext i32 %i.02 to i64 %arrayidx = getelementptr inbounds i32* %b, i64 %idxprom %0 = load i32* %arrayidx, align 4 %mul = mul nsw i32 %0, 3 - %idxprom1 = sext i32 %i.0 to i64 + %idxprom1 = sext i32 %i.02 to i64 %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %idxprom1 store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 - %inc = add nsw i32 %i.0, 1 - br label %for.cond + %inc = add nsw i32 %i.02, 1 + %cmp = icmp slt i32 %inc, %n + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body, %entry ret void } @@ -119,25 +113,23 @@ define void @bar2(i32* noalias %a, i32 addrspace(1)* noalias %b, i32 %n) #0 { ; CHECK: ret entry: - br label %for.cond - -for.cond: ; preds = %for.body, %entry - %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.body, label %for.end + %cmp1 = icmp slt i32 0, %n + br i1 %cmp1, label %for.body, label %for.end -for.body: ; preds = %for.cond - %idxprom = sext i32 %i.0 to i64 +for.body: ; preds = %entry, %for.body + %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] + %idxprom = sext i32 %i.02 to i64 %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %idxprom %0 = load i32 addrspace(1)* %arrayidx, align 4 %mul = mul nsw i32 %0, 3 - %idxprom1 = sext i32 %i.0 to i64 + %idxprom1 = sext i32 %i.02 to i64 %arrayidx2 = getelementptr inbounds i32* %a, i64 %idxprom1 store i32 %mul, i32* %arrayidx2, align 4 - %inc = add nsw i32 %i.0, 1 - br label %for.cond + %inc = add nsw i32 %i.02, 1 + %cmp = icmp slt i32 %inc, %n + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body, %entry ret void } @@ -149,25 +141,23 @@ define void @arst0(i32* %b, i32 %n) #0 { ; CHECK: ret entry: - br label %for.cond - -for.cond: ; preds = %for.body, %entry - %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.body, label %for.end + %cmp1 = icmp slt i32 0, %n + br i1 %cmp1, label %for.body, label %for.end -for.body: ; preds = %for.cond - %idxprom = sext i32 %i.0 to i64 +for.body: ; preds = %entry, %for.body + %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] + %idxprom = sext i32 %i.02 to i64 %arrayidx = getelementptr inbounds i32* %b, i64 %idxprom %0 = load i32* %arrayidx, align 4 %mul = mul nsw i32 %0, 3 - %idxprom1 = sext i32 %i.0 to i64 + %idxprom1 = sext i32 %i.02 to i64 %arrayidx2 = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom1 store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 - %inc = add nsw i32 %i.0, 1 - br label %for.cond + %inc = add nsw i32 %i.02, 1 + %cmp = icmp slt i32 %inc, %n + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body, %entry ret void } @@ -180,25 +170,23 @@ define void @arst1(i32* %b, i32 %n) #0 { ; CHECK: ret entry: - br label %for.cond - -for.cond: ; preds = %for.body, %entry - %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.body, label %for.end + %cmp1 = icmp slt i32 0, %n + br i1 %cmp1, label %for.body, label %for.end -for.body: ; preds = %for.cond - %idxprom = sext i32 %i.0 to i64 +for.body: ; preds = %entry, %for.body + %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] + %idxprom = sext i32 %i.02 to i64 %arrayidx = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom %0 = load i32 addrspace(1)* %arrayidx, align 4 %mul = mul nsw i32 %0, 3 - %idxprom1 = sext i32 %i.0 to i64 + %idxprom1 = sext i32 %i.02 to i64 %arrayidx2 = getelementptr inbounds i32* %b, i64 %idxprom1 store i32 %mul, i32* %arrayidx2, align 4 - %inc = add nsw i32 %i.0, 1 - br label %for.cond + %inc = add nsw i32 %i.02, 1 + %cmp = icmp slt i32 %inc, %n + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body, %entry ret void } @@ -210,25 +198,23 @@ define void @aoeu(i32 %n) #0 { ; CHECK: ret entry: - br label %for.cond + %cmp1 = icmp slt i32 0, %n + br i1 %cmp1, label %for.body, label %for.end -for.cond: ; preds = %for.body, %entry - %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp slt i32 %i.0, %n - br i1 %cmp, label %for.body, label %for.end - -for.body: ; preds = %for.cond - %idxprom = sext i32 %i.0 to i64 +for.body: ; preds = %entry, %for.body + %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ] + %idxprom = sext i32 %i.02 to i64 %arrayidx = getelementptr inbounds [1024 x i32] addrspace(2)* @q_as2, i64 0, i64 %idxprom %0 = load i32 addrspace(2)* %arrayidx, align 4 %mul = mul nsw i32 %0, 3 - %idxprom1 = sext i32 %i.0 to i64 + %idxprom1 = sext i32 %i.02 to i64 %arrayidx2 = getelementptr inbounds [1024 x i32] addrspace(1)* @g_as1, i64 0, i64 %idxprom1 store i32 %mul, i32 addrspace(1)* %arrayidx2, align 4 - %inc = add nsw i32 %i.0, 1 - br label %for.cond + %inc = add nsw i32 %i.02, 1 + %cmp = icmp slt i32 %inc, %n + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body, %entry ret void } diff --git a/test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll b/test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll index 56f1f99..12ba3ce 100644 --- a/test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll +++ b/test/Transforms/LoopVectorize/runtime-check-readonly-address-space.ll @@ -8,26 +8,24 @@ define void @add_ints_1_1_1(i32 addrspace(1)* %a, i32 addrspace(1)* %b, i32 addr ; CHECK-LABEL: @add_ints_1_1_1( ; CHECK: <4 x i32> ; CHECK: ret -entry: - br label %for.cond -for.cond: ; preds = %for.body, %entry - %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp ult i64 %i.0, 200 - br i1 %cmp, label %for.body, label %for.end +entry: + br label %for.body -for.body: ; preds = %for.cond - %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 +for.body: ; preds = %entry, %for.body + %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] + %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 %0 = load i32 addrspace(1)* %arrayidx, align 4 - %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0 + %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.01 %1 = load i32 addrspace(1)* %arrayidx1, align 4 %add = add nsw i32 %0, %1 - %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0 + %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.01 store i32 %add, i32 addrspace(1)* %arrayidx2, align 4 - %inc = add i64 %i.0, 1 - br label %for.cond + %inc = add i64 %i.01, 1 + %cmp = icmp ult i64 %inc, 200 + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body ret void } @@ -35,26 +33,24 @@ define void @add_ints_as_1_0_0(i32 addrspace(1)* %a, i32* %b, i32* %c) #0 { ; CHECK-LABEL: @add_ints_as_1_0_0( ; CHECK-NOT: <4 x i32> ; CHECK: ret -entry: - br label %for.cond -for.cond: ; preds = %for.body, %entry - %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp ult i64 %i.0, 200 - br i1 %cmp, label %for.body, label %for.end +entry: + br label %for.body -for.body: ; preds = %for.cond - %arrayidx = getelementptr inbounds i32* %b, i64 %i.0 +for.body: ; preds = %entry, %for.body + %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] + %arrayidx = getelementptr inbounds i32* %b, i64 %i.01 %0 = load i32* %arrayidx, align 4 - %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0 + %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.01 %1 = load i32* %arrayidx1, align 4 %add = add nsw i32 %0, %1 - %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.0 + %arrayidx2 = getelementptr inbounds i32 addrspace(1)* %a, i64 %i.01 store i32 %add, i32 addrspace(1)* %arrayidx2, align 4 - %inc = add i64 %i.0, 1 - br label %for.cond + %inc = add i64 %i.01, 1 + %cmp = icmp ult i64 %inc, 200 + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body ret void } @@ -62,26 +58,24 @@ define void @add_ints_as_0_1_0(i32* %a, i32 addrspace(1)* %b, i32* %c) #0 { ; CHECK-LABEL: @add_ints_as_0_1_0( ; CHECK-NOT: <4 x i32> ; CHECK: ret -entry: - br label %for.cond -for.cond: ; preds = %for.body, %entry - %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp ult i64 %i.0, 200 - br i1 %cmp, label %for.body, label %for.end +entry: + br label %for.body -for.body: ; preds = %for.cond - %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 +for.body: ; preds = %entry, %for.body + %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] + %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 %0 = load i32 addrspace(1)* %arrayidx, align 4 - %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.0 + %arrayidx1 = getelementptr inbounds i32* %c, i64 %i.01 %1 = load i32* %arrayidx1, align 4 %add = add nsw i32 %0, %1 - %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 + %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.01 store i32 %add, i32* %arrayidx2, align 4 - %inc = add i64 %i.0, 1 - br label %for.cond + %inc = add i64 %i.01, 1 + %cmp = icmp ult i64 %inc, 200 + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body ret void } @@ -89,26 +83,24 @@ define void @add_ints_as_0_1_1(i32* %a, i32 addrspace(1)* %b, i32 addrspace(1)* ; CHECK-LABEL: @add_ints_as_0_1_1( ; CHECK-NOT: <4 x i32> ; CHECK: ret -entry: - br label %for.cond -for.cond: ; preds = %for.body, %entry - %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp ult i64 %i.0, 200 - br i1 %cmp, label %for.body, label %for.end +entry: + br label %for.body -for.body: ; preds = %for.cond - %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 +for.body: ; preds = %entry, %for.body + %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] + %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 %0 = load i32 addrspace(1)* %arrayidx, align 4 - %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.0 + %arrayidx1 = getelementptr inbounds i32 addrspace(1)* %c, i64 %i.01 %1 = load i32 addrspace(1)* %arrayidx1, align 4 %add = add nsw i32 %0, %1 - %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 + %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.01 store i32 %add, i32* %arrayidx2, align 4 - %inc = add i64 %i.0, 1 - br label %for.cond + %inc = add i64 %i.01, 1 + %cmp = icmp ult i64 %inc, 200 + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body ret void } @@ -116,26 +108,24 @@ define void @add_ints_as_0_1_2(i32* %a, i32 addrspace(1)* %b, i32 addrspace(2)* ; CHECK-LABEL: @add_ints_as_0_1_2( ; CHECK-NOT: <4 x i32> ; CHECK: ret -entry: - br label %for.cond -for.cond: ; preds = %for.body, %entry - %i.0 = phi i64 [ 0, %entry ], [ %inc, %for.body ] - %cmp = icmp ult i64 %i.0, 200 - br i1 %cmp, label %for.body, label %for.end +entry: + br label %for.body -for.body: ; preds = %for.cond - %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.0 +for.body: ; preds = %entry, %for.body + %i.01 = phi i64 [ 0, %entry ], [ %inc, %for.body ] + %arrayidx = getelementptr inbounds i32 addrspace(1)* %b, i64 %i.01 %0 = load i32 addrspace(1)* %arrayidx, align 4 - %arrayidx1 = getelementptr inbounds i32 addrspace(2)* %c, i64 %i.0 + %arrayidx1 = getelementptr inbounds i32 addrspace(2)* %c, i64 %i.01 %1 = load i32 addrspace(2)* %arrayidx1, align 4 %add = add nsw i32 %0, %1 - %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.0 + %arrayidx2 = getelementptr inbounds i32* %a, i64 %i.01 store i32 %add, i32* %arrayidx2, align 4 - %inc = add i64 %i.0, 1 - br label %for.cond + %inc = add i64 %i.01, 1 + %cmp = icmp ult i64 %inc, 200 + br i1 %cmp, label %for.body, label %for.end -for.end: ; preds = %for.cond +for.end: ; preds = %for.body ret void } diff --git a/test/Transforms/LoopVectorize/scev-exitlim-crash.ll b/test/Transforms/LoopVectorize/scev-exitlim-crash.ll index 1bce3f8..5154771 100644 --- a/test/Transforms/LoopVectorize/scev-exitlim-crash.ll +++ b/test/Transforms/LoopVectorize/scev-exitlim-crash.ll @@ -106,9 +106,9 @@ declare i32 @fn2(double) #1 attributes #0 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } -!0 = metadata !{metadata !"int", metadata !1} -!1 = metadata !{metadata !"omnipotent char", metadata !2} -!2 = metadata !{metadata !"Simple C/C++ TBAA"} -!3 = metadata !{metadata !"double", metadata !1} -!4 = metadata !{metadata !0, metadata !0, i64 0} -!5 = metadata !{metadata !3, metadata !3, i64 0} +!0 = !{!"int", !1} +!1 = !{!"omnipotent char", !2} +!2 = !{!"Simple C/C++ TBAA"} +!3 = !{!"double", !1} +!4 = !{!0, !0, i64 0} +!5 = !{!3, !3, i64 0} diff --git a/test/Transforms/LoopVectorize/tbaa-nodep.ll b/test/Transforms/LoopVectorize/tbaa-nodep.ll index 5cd104c..be3e74f 100644 --- a/test/Transforms/LoopVectorize/tbaa-nodep.ll +++ b/test/Transforms/LoopVectorize/tbaa-nodep.ll @@ -93,10 +93,10 @@ for.end: ; preds = %for.body attributes #0 = { nounwind uwtable } -!0 = metadata !{metadata !1, metadata !1, i64 0} -!1 = metadata !{metadata !"float", metadata !2, i64 0} -!2 = metadata !{metadata !"omnipotent char", metadata !3, i64 0} -!3 = metadata !{metadata !"Simple C/C++ TBAA"} -!4 = metadata !{metadata !5, metadata !5, i64 0} -!5 = metadata !{metadata !"int", metadata !2, i64 0} +!0 = !{!1, !1, i64 0} +!1 = !{!"float", !2, i64 0} +!2 = !{!"omnipotent char", !3, i64 0} +!3 = !{!"Simple C/C++ TBAA"} +!4 = !{!5, !5, i64 0} +!5 = !{!"int", !2, i64 0} diff --git a/test/Transforms/LoopVectorize/vect.omp.persistence.ll b/test/Transforms/LoopVectorize/vect.omp.persistence.ll index b0fe7a5..ea7be9c 100644 --- a/test/Transforms/LoopVectorize/vect.omp.persistence.ll +++ b/test/Transforms/LoopVectorize/vect.omp.persistence.ll @@ -61,8 +61,8 @@ for.end: ret void } -!1 = metadata !{metadata !1, metadata !2} -!2 = metadata !{metadata !"llvm.loop.vectorize.enable", i1 true} +!1 = !{!1, !2} +!2 = !{!"llvm.loop.vectorize.enable", i1 true} ; ; Test #2 @@ -84,5 +84,5 @@ return: ret i32 0 } -!3 = metadata !{metadata !3, metadata !4} -!4 = metadata !{metadata !"llvm.loop.vectorize.enable", i1 true} +!3 = !{!3, !4} +!4 = !{!"llvm.loop.vectorize.enable", i1 true} diff --git a/test/Transforms/LoopVectorize/vect.stats.ll b/test/Transforms/LoopVectorize/vect.stats.ll index 556da45..c5b6e64 100644 --- a/test/Transforms/LoopVectorize/vect.stats.ll +++ b/test/Transforms/LoopVectorize/vect.stats.ll @@ -13,53 +13,47 @@ target triple = "x86_64-unknown-linux-gnu" define void @vectorized(float* nocapture %a, i64 %size) { entry: - %cmp1 = icmp sgt i64 %size, 0 - br i1 %cmp1, label %for.header, label %for.end - -for.header: - %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] - %cmp2 = icmp sgt i64 %indvars.iv, %size - br i1 %cmp2, label %for.end, label %for.body - -for.body: - - %arrayidx = getelementptr inbounds float* %a, i64 %indvars.iv + %cmp1 = icmp sle i64 %size, 0 + %cmp21 = icmp sgt i64 0, %size + %or.cond = or i1 %cmp1, %cmp21 + br i1 %or.cond, label %for.end, label %for.body + +for.body: ; preds = %entry, %for.body + %indvars.iv2 = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] + %arrayidx = getelementptr inbounds float* %a, i64 %indvars.iv2 %0 = load float* %arrayidx, align 4 %mul = fmul float %0, %0 store float %mul, float* %arrayidx, align 4 + %indvars.iv.next = add nuw nsw i64 %indvars.iv2, 1 + %cmp2 = icmp sgt i64 %indvars.iv.next, %size + br i1 %cmp2, label %for.end, label %for.body - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - br label %for.header - -for.end: +for.end: ; preds = %entry, %for.body ret void } define void @not_vectorized(float* nocapture %a, i64 %size) { entry: - %cmp1 = icmp sgt i64 %size, 0 - br i1 %cmp1, label %for.header, label %for.end - -for.header: - %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] - %cmp2 = icmp sgt i64 %indvars.iv, %size - br i1 %cmp2, label %for.end, label %for.body - -for.body: - - %0 = add nsw i64 %indvars.iv, -5 + %cmp1 = icmp sle i64 %size, 0 + %cmp21 = icmp sgt i64 0, %size + %or.cond = or i1 %cmp1, %cmp21 + br i1 %or.cond, label %for.end, label %for.body + +for.body: ; preds = %entry, %for.body + %indvars.iv2 = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ] + %0 = add nsw i64 %indvars.iv2, -5 %arrayidx = getelementptr inbounds float* %a, i64 %0 %1 = load float* %arrayidx, align 4 - %2 = add nsw i64 %indvars.iv, 2 + %2 = add nsw i64 %indvars.iv2, 2 %arrayidx2 = getelementptr inbounds float* %a, i64 %2 %3 = load float* %arrayidx2, align 4 %mul = fmul float %1, %3 - %arrayidx4 = getelementptr inbounds float* %a, i64 %indvars.iv + %arrayidx4 = getelementptr inbounds float* %a, i64 %indvars.iv2 store float %mul, float* %arrayidx4, align 4 + %indvars.iv.next = add nuw nsw i64 %indvars.iv2, 1 + %cmp2 = icmp sgt i64 %indvars.iv.next, %size + br i1 %cmp2, label %for.end, label %for.body - %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 - br label %for.header - -for.end: +for.end: ; preds = %entry, %for.body ret void } diff --git a/test/Transforms/LoopVectorize/vectorize-once.ll b/test/Transforms/LoopVectorize/vectorize-once.ll index cee4b16..a9b2a53 100644 --- a/test/Transforms/LoopVectorize/vectorize-once.ll +++ b/test/Transforms/LoopVectorize/vectorize-once.ll @@ -68,10 +68,10 @@ _ZSt10accumulateIPiiET0_T_S2_S1_.exit: ; preds = %for.body.i, %entry attributes #0 = { nounwind readonly ssp uwtable "fp-contract-model"="standard" "no-frame-pointer-elim" "no-frame-pointer-elim-non-leaf" "realign-stack" "relocation-model"="pic" "ssp-buffers-size"="8" } -; CHECK: !0 = metadata !{metadata !0, metadata !1, metadata !2} -; CHECK: !1 = metadata !{metadata !"llvm.loop.vectorize.width", i32 1} -; CHECK: !2 = metadata !{metadata !"llvm.loop.interleave.count", i32 1} -; CHECK: !3 = metadata !{metadata !3, metadata !1, metadata !2} +; CHECK: !0 = distinct !{!0, !1, !2} +; CHECK: !1 = !{!"llvm.loop.vectorize.width", i32 1} +; CHECK: !2 = !{!"llvm.loop.interleave.count", i32 1} +; CHECK: !3 = distinct !{!3, !1, !2} -!0 = metadata !{metadata !0, metadata !1} -!1 = metadata !{metadata !"llvm.loop.vectorize.width", i32 1} +!0 = !{!0, !1} +!1 = !{!"llvm.loop.vectorize.width", i32 1} diff --git a/test/Transforms/LoopVectorize/version-mem-access.ll b/test/Transforms/LoopVectorize/version-mem-access.ll index 7ac2fca..37145aa 100644 --- a/test/Transforms/LoopVectorize/version-mem-access.ll +++ b/test/Transforms/LoopVectorize/version-mem-access.ll @@ -2,10 +2,16 @@ target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" +; Check that we version this loop with speculating the value 1 for symbolic +; strides. This also checks that the symbolic stride information is correctly +; propagated to the memcheck generation. Without this the loop wouldn't +; vectorize because we couldn't determine the array bounds for the required +; memchecks. + ; CHECK-LABEL: test -define void @test(i32* noalias %A, i64 %AStride, - i32* noalias %B, i32 %BStride, - i32* noalias %C, i64 %CStride, i32 %N) { +define void @test(i32* %A, i64 %AStride, + i32* %B, i32 %BStride, + i32* %C, i64 %CStride, i32 %N) { entry: %cmp13 = icmp eq i32 %N, 0 br i1 %cmp13, label %for.end, label %for.body.preheader |