summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopVectorize
diff options
context:
space:
mode:
authorKarl-Johan Karlsson <karl-johan.karlsson@ericsson.com>2018-05-09 13:34:57 +0000
committerKarl-Johan Karlsson <karl-johan.karlsson@ericsson.com>2018-05-09 13:34:57 +0000
commitb27dd33c58db26f7115ddd39505479d0a50777dc (patch)
tree32a994f35f12189de740e4b55f37a0fd3bf81b82 /llvm/test/Transforms/LoopVectorize
parent59055b94afbfe57a0cdcc230e7d066c275a03619 (diff)
downloadbcm5719-llvm-b27dd33c58db26f7115ddd39505479d0a50777dc.tar.gz
bcm5719-llvm-b27dd33c58db26f7115ddd39505479d0a50777dc.zip
[LV] Add lit testcase for bitcast problem. NFC
llvm-svn: 331878
Diffstat (limited to 'llvm/test/Transforms/LoopVectorize')
-rw-r--r--llvm/test/Transforms/LoopVectorize/X86/constant-fold.ll54
1 files changed, 54 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopVectorize/X86/constant-fold.ll b/llvm/test/Transforms/LoopVectorize/X86/constant-fold.ll
new file mode 100644
index 00000000000..d429de5fe43
--- /dev/null
+++ b/llvm/test/Transforms/LoopVectorize/X86/constant-fold.ll
@@ -0,0 +1,54 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -loop-vectorize -S -mtriple=x86_64-- -o - %s | FileCheck %s
+
+; Testcase that point out faulty bitcast that cast between different sizes.
+; See "bitcast ([1 x %rec8]* @a to <2 x i16*>)" in checks below
+
+%rec8 = type { i16 }
+
+@a = global [1 x %rec8] zeroinitializer
+@b = global [2 x i16*] zeroinitializer
+
+
+define void @f1() {
+; CHECK-LABEL: @f1(
+; CHECK-NEXT: bb1:
+; CHECK-NEXT: br i1 false, label [[SCALAR_PH:%.*]], label [[VECTOR_PH:%.*]]
+; CHECK: vector.ph:
+; CHECK-NEXT: br label [[VECTOR_BODY:%.*]]
+; CHECK: vector.body:
+; CHECK-NEXT: [[INDEX:%.*]] = phi i32 [ 0, [[VECTOR_PH]] ], [ [[INDEX_NEXT:%.*]], [[VECTOR_BODY]] ]
+; CHECK-NEXT: [[TMP0:%.*]] = trunc i32 [[INDEX]] to i16
+; CHECK-NEXT: [[OFFSET_IDX:%.*]] = add i16 0, [[TMP0]]
+; CHECK-NEXT: [[BROADCAST_SPLATINSERT:%.*]] = insertelement <2 x i16> undef, i16 [[OFFSET_IDX]], i32 0
+; CHECK-NEXT: [[BROADCAST_SPLAT:%.*]] = shufflevector <2 x i16> [[BROADCAST_SPLATINSERT]], <2 x i16> undef, <2 x i32> zeroinitializer
+; CHECK-NEXT: [[INDUCTION:%.*]] = add <2 x i16> [[BROADCAST_SPLAT]], <i16 0, i16 1>
+; CHECK-NEXT: [[TMP1:%.*]] = add i16 [[OFFSET_IDX]], 0
+; CHECK-NEXT: [[TMP2:%.*]] = sext i16 [[TMP1]] to i64
+; CHECK-NEXT: [[TMP3:%.*]] = getelementptr [2 x i16*], [2 x i16*]* @b, i16 0, i64 [[TMP2]]
+; CHECK-NEXT: [[TMP4:%.*]] = getelementptr i16*, i16** [[TMP3]], i32 0
+; CHECK-NEXT: [[TMP5:%.*]] = bitcast i16** [[TMP4]] to <2 x i16*>*
+; CHECK-NEXT: store <2 x i16*> bitcast ([1 x %rec8]* @a to <2 x i16*>), <2 x i16*>* [[TMP5]], align 8
+; CHECK-NEXT: [[INDEX_NEXT]] = add i32 [[INDEX]], 2
+; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[INDEX_NEXT]], 2
+; CHECK-NEXT: br i1 [[TMP6]], label [[MIDDLE_BLOCK:%.*]], label [[VECTOR_BODY]], !llvm.loop !0
+; CHECK: middle.block:
+
+bb1:
+ br label %bb2
+
+bb2:
+ %c.1.0 = phi i16 [ 0, %bb1 ], [ %_tmp9, %bb2 ]
+ %_tmp1 = zext i16 0 to i64
+ %_tmp2 = getelementptr [1 x %rec8], [1 x %rec8]* @a, i16 0, i64 %_tmp1
+ %_tmp4 = bitcast %rec8* %_tmp2 to i16*
+ %_tmp6 = sext i16 %c.1.0 to i64
+ %_tmp7 = getelementptr [2 x i16*], [2 x i16*]* @b, i16 0, i64 %_tmp6
+ store i16* %_tmp4, i16** %_tmp7
+ %_tmp9 = add nsw i16 %c.1.0, 1
+ %_tmp11 = icmp slt i16 %_tmp9, 2
+ br i1 %_tmp11, label %bb2, label %bb3
+
+bb3:
+ ret void
+}
OpenPOWER on IntegriCloud