[PATCH] D46379: [ConstantFold] Turn off expression simplification for vector type
Karl-Johan Karlsson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 9 07:19:20 PDT 2018
Ka-Ka updated this revision to Diff 145910.
Ka-Ka marked an inline comment as done.
Ka-Ka added a comment.
Changed testcase according what was suggested by lebedev.ri
Repository:
rL LLVM
https://reviews.llvm.org/D46379
Files:
lib/IR/ConstantFold.cpp
test/Transforms/LoopVectorize/X86/constant-fold.ll
Index: test/Transforms/LoopVectorize/X86/constant-fold.ll
===================================================================
--- test/Transforms/LoopVectorize/X86/constant-fold.ll
+++ test/Transforms/LoopVectorize/X86/constant-fold.ll
@@ -2,7 +2,6 @@
; 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 }
@@ -28,7 +27,7 @@
; 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: store <2 x i16*> <i16* getelementptr inbounds (%rec8, %rec8* extractelement (<2 x %rec8*> getelementptr ([1 x %rec8], [1 x %rec8]* @a, <2 x i16> zeroinitializer, <2 x i64> zeroinitializer), i32 0), i32 0, i32 0), i16* getelementptr inbounds (%rec8, %rec8* extractelement (<2 x %rec8*> getelementptr ([1 x %rec8], [1 x %rec8]* @a, <2 x i16> zeroinitializer, <2 x i64> zeroinitializer), i32 1), i32 0, i32 0)>, <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
Index: lib/IR/ConstantFold.cpp
===================================================================
--- lib/IR/ConstantFold.cpp
+++ lib/IR/ConstantFold.cpp
@@ -534,7 +534,8 @@
// If the cast operand is a constant expression, there's a few things we can
// do to try to simplify it.
- if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
+ ConstantExpr *CE = dyn_cast<ConstantExpr>(V);
+ if (CE && !DestTy->isVectorTy()) {
if (CE->isCast()) {
// Try hard to fold cast of cast because they are often eliminable.
if (unsigned newOpc = foldConstantCastPair(opc, CE, DestTy))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46379.145910.patch
Type: text/x-patch
Size: 2133 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180509/4727ea6e/attachment.bin>
More information about the llvm-commits
mailing list