[PATCH] D124015: [InstCombine] Don't look through bitcast from vector in collectInsertionElements.
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 19 10:28:55 PDT 2022
craig.topper updated this revision to Diff 423665.
craig.topper added a comment.
Remove FIXME from test case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124015/new/
https://reviews.llvm.org/D124015
Files:
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/test/Transforms/InstCombine/bitcast.ll
Index: llvm/test/Transforms/InstCombine/bitcast.ll
===================================================================
--- llvm/test/Transforms/InstCombine/bitcast.ll
+++ llvm/test/Transforms/InstCombine/bitcast.ll
@@ -431,12 +431,14 @@
ret <2 x float> %tmp35
}
-; FIXME: This test should not be optimized by OptimizeIntegerToVectorInsertions.
-; The bitcast from vector is confusing it.
+; This test should not be optimized by OptimizeIntegerToVectorInsertions.
+; The bitcast from vector previously confused it.
define <2 x i64> @int2vec_insertion_bitcast_from_vec(i64 %x) {
; CHECK-LABEL: @int2vec_insertion_bitcast_from_vec(
-; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i64> <i64 poison, i64 0>, i64 [[X:%.*]], i64 0
-; CHECK-NEXT: ret <2 x i64> [[TMP1]]
+; CHECK-NEXT: [[A:%.*]] = bitcast i64 [[X:%.*]] to <8 x i8>
+; CHECK-NEXT: [[B:%.*]] = zext <8 x i8> [[A]] to <8 x i16>
+; CHECK-NEXT: [[D:%.*]] = bitcast <8 x i16> [[B]] to <2 x i64>
+; CHECK-NEXT: ret <2 x i64> [[D]]
;
%a = bitcast i64 %x to <8 x i8>
%b = zext <8 x i8> %a to <8 x i16>
Index: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -2271,6 +2271,8 @@
switch (I->getOpcode()) {
default: return false; // Unhandled case.
case Instruction::BitCast:
+ if (I->getOperand(0)->getType()->isVectorTy())
+ return false;
return collectInsertionElements(I->getOperand(0), Shift, Elements, VecEltTy,
isBigEndian);
case Instruction::ZExt:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124015.423665.patch
Type: text/x-patch
Size: 1686 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220419/f8ec127e/attachment.bin>
More information about the llvm-commits
mailing list