summaryrefslogtreecommitdiff
path: root/test/Transforms/LoopVectorize/version-mem-access.ll
diff options
context:
space:
mode:
authorArnold Schwaighofer <aschwaighofer@apple.com>2014-01-15 03:35:46 +0000
committerArnold Schwaighofer <aschwaighofer@apple.com>2014-01-15 03:35:46 +0000
commite96fec2e436003714a6bf3739d594d77701da1e5 (patch)
tree95c6bae99bcff262d0e79073cfc65f4f10f825c4 /test/Transforms/LoopVectorize/version-mem-access.ll
parent574df95d7ae58d9294662d513a66a77316329841 (diff)
downloadllvm-e96fec2e436003714a6bf3739d594d77701da1e5.tar.gz
llvm-e96fec2e436003714a6bf3739d594d77701da1e5.tar.bz2
llvm-e96fec2e436003714a6bf3739d594d77701da1e5.tar.xz
LoopVectorize: Only strip casts from integer types when replacing symbolic
strides Fixes PR18480. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/LoopVectorize/version-mem-access.ll')
-rw-r--r--test/Transforms/LoopVectorize/version-mem-access.ll37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/Transforms/LoopVectorize/version-mem-access.ll b/test/Transforms/LoopVectorize/version-mem-access.ll
index e712728111..51d20e227d 100644
--- a/test/Transforms/LoopVectorize/version-mem-access.ll
+++ b/test/Transforms/LoopVectorize/version-mem-access.ll
@@ -48,3 +48,40 @@ for.end.loopexit:
for.end:
ret void
}
+
+; We used to crash on this function because we removed the fptosi cast when
+; replacing the symbolic stride '%conv'.
+; PR18480
+
+; CHECK-LABEL: fn1
+; CHECK: load <2 x double>
+
+define void @fn1(double* noalias %x, double* noalias %c, double %a) {
+entry:
+ %conv = fptosi double %a to i32
+ %cmp8 = icmp sgt i32 %conv, 0
+ br i1 %cmp8, label %for.body.preheader, label %for.end
+
+for.body.preheader:
+ br label %for.body
+
+for.body:
+ %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]
+ %0 = trunc i64 %indvars.iv to i32
+ %mul = mul nsw i32 %0, %conv
+ %idxprom = sext i32 %mul to i64
+ %arrayidx = getelementptr inbounds double* %x, i64 %idxprom
+ %1 = load double* %arrayidx, align 8
+ %arrayidx3 = getelementptr inbounds double* %c, i64 %indvars.iv
+ store double %1, double* %arrayidx3, align 8
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+ %lftr.wideiv = trunc i64 %indvars.iv.next to i32
+ %exitcond = icmp eq i32 %lftr.wideiv, %conv
+ br i1 %exitcond, label %for.end.loopexit, label %for.body
+
+for.end.loopexit:
+ br label %for.end
+
+for.end:
+ ret void
+}