[PATCH] D80559: [SVE] Remove getNumElements() warnings in InstCombiner::visitBitCast
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 29 00:30:33 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf254f1d94e8d: [SVE] Remove getNumElements() warnings in InstCombiner::visitBitCast (authored by david-arm).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80559/new/
https://reviews.llvm.org/D80559
Files:
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/test/Transforms/InstCombine/AArch64/sve-bitcast.ll
Index: llvm/test/Transforms/InstCombine/AArch64/sve-bitcast.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/InstCombine/AArch64/sve-bitcast.ll
@@ -0,0 +1,13 @@
+; RUN: opt -instcombine -mtriple=aarch64-linux-gnu -mattr=+sve -S < %s | FileCheck %s
+
+; We shouldn't fold bitcast(insert <vscale x 1 x iX> .., iX %val, i32 0)
+; into bitcast(iX %val) for scalable vectors.
+define <vscale x 2 x i8> @bitcast_of_insert_i8_i16(i16 %val) #0 {
+; CHECK-LABEL: @bitcast_of_insert_i8_i16(
+; CHECK-NOT: bitcast i16 %val to <vscale x 2 x i8>
+; CHECK: bitcast <vscale x 1 x i16> %op2 to <vscale x 2 x i8>
+entry:
+ %op2 = insertelement <vscale x 1 x i16> undef, i16 %val, i32 0
+ %0 = bitcast <vscale x 1 x i16> %op2 to <vscale x 2 x i8>
+ ret <vscale x 2 x i8> %0
+}
Index: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -2534,7 +2534,7 @@
}
}
- if (VectorType *DestVTy = dyn_cast<VectorType>(DestTy)) {
+ if (FixedVectorType *DestVTy = dyn_cast<FixedVectorType>(DestTy)) {
// Beware: messing with this target-specific oddity may cause trouble.
if (DestVTy->getNumElements() == 1 && SrcTy->isX86_MMXTy()) {
Value *Elem = Builder.CreateBitCast(Src, DestVTy->getElementType());
@@ -2563,7 +2563,7 @@
}
}
- if (VectorType *SrcVTy = dyn_cast<VectorType>(SrcTy)) {
+ if (FixedVectorType *SrcVTy = dyn_cast<FixedVectorType>(SrcTy)) {
if (SrcVTy->getNumElements() == 1) {
// If our destination is not a vector, then make this a straight
// scalar-scalar cast.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80559.267135.patch
Type: text/x-patch
Size: 1768 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200529/4b65fdc5/attachment.bin>
More information about the llvm-commits
mailing list