[PATCH] D80559: [SVE] Remove getNumElements() warnings in InstCombiner::visitBitCast
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 26 08:38:56 PDT 2020
david-arm created this revision.
david-arm added reviewers: sdesmalen, fpetrogalli, ctetreau.
Herald added subscribers: llvm-commits, psnobl, rkruppe, hiraditya, kristof.beyls, tschuett.
Herald added a reviewer: rengolin.
Herald added a reviewer: efriedma.
Herald added a project: LLVM.
Whilst trying to compile this test to assembly:
CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret.c
I discovered some warnings were firing in InstCombiner::visitBitCast
due to calls to getNumElements() for scalable vector types. These
calls only really made sense for fixed width vectors so I have fixed
up the code appropriately.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D80559
Files:
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
Index: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -2528,7 +2528,8 @@
if (VectorType *DestVTy = dyn_cast<VectorType>(DestTy)) {
// Beware: messing with this target-specific oddity may cause trouble.
- if (DestVTy->getNumElements() == 1 && SrcTy->isX86_MMXTy()) {
+ if (isa<FixedVectorType>(DestVTy) && DestVTy->getNumElements() == 1 &&
+ SrcTy->isX86_MMXTy()) {
Value *Elem = Builder.CreateBitCast(Src, DestVTy->getElementType());
return InsertElementInst::Create(UndefValue::get(DestTy), Elem,
Constant::getNullValue(Type::getInt32Ty(CI.getContext())));
@@ -2555,7 +2556,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.266219.patch
Type: text/x-patch
Size: 1116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200526/a160b846/attachment.bin>
More information about the llvm-commits
mailing list