summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorKeno Fischer <kfischer@college.harvard.edu>2016-12-08 17:22:35 +0000
committerKeno Fischer <kfischer@college.harvard.edu>2016-12-08 17:22:35 +0000
commitdc09119776454a9dabbe87150b3ca04140fb65fb (patch)
tree7335fa837abd99fdf122c623e57cde8892cee976 /llvm/test
parent8cb6283e74aae927180a87836dba8dc75aa72253 (diff)
downloadbcm5719-llvm-dc09119776454a9dabbe87150b3ca04140fb65fb.tar.gz
bcm5719-llvm-dc09119776454a9dabbe87150b3ca04140fb65fb.zip
ConstantFolding: Don't crash when encountering vector GEP
ConstantFolding tried to cast one of the scalar indices to a vector type. Instead, use the vector type only for the first index (which is the only one allowed to be a vector) and use its scalar type otherwise. Fixes PR31250. Reviewers: majnemer Differential Revision: https://reviews.llvm.org/D27389 llvm-svn: 289073
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Analysis/ConstantFolding/vectorgep-crash.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Analysis/ConstantFolding/vectorgep-crash.ll b/llvm/test/Analysis/ConstantFolding/vectorgep-crash.ll
new file mode 100644
index 00000000000..bcc96b2676b
--- /dev/null
+++ b/llvm/test/Analysis/ConstantFolding/vectorgep-crash.ll
@@ -0,0 +1,19 @@
+; RUN: opt -instcombine -S -o - %s | FileCheck %s
+; Tests that we don't crash upon encountering a vector GEP
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
+%Dual = type { %Dual.72, %Partials.73 }
+%Dual.72 = type { double, %Partials }
+%Partials = type { [2 x double] }
+%Partials.73 = type { [2 x %Dual.72] }
+
+; Function Attrs: sspreq
+define <8 x i64*> @"julia_axpy!_65480"(%Dual* %arg1, <8 x i64> %arg2) {
+top:
+; CHECK: %VectorGep14 = getelementptr inbounds %Dual, %Dual* %arg1, <8 x i64> %arg2, i32 1, i32 0, i64 0, i32 1, i32 0, i64 0
+ %VectorGep14 = getelementptr inbounds %Dual, %Dual* %arg1, <8 x i64> %arg2, i32 1, i32 0, i64 0, i32 1, i32 0, i64 0
+ %0 = bitcast <8 x double*> %VectorGep14 to <8 x i64*>
+ ret <8 x i64*> %0
+}
OpenPOWER on IntegriCloud