[llvm] b6c6bab - [SVE] Fix incorrect usage of getNumElements() in InstCombineCalls
Christopher Tetreault via llvm-commits
llvm-commits at lists.llvm.org
Thu May 7 08:47:15 PDT 2020
Author: Christopher Tetreault
Date: 2020-05-07T08:46:51-07:00
New Revision: b6c6bab9a5b4e83e14883767cc9d3fb352574878
URL: https://github.com/llvm/llvm-project/commit/b6c6bab9a5b4e83e14883767cc9d3fb352574878
DIFF: https://github.com/llvm/llvm-project/commit/b6c6bab9a5b4e83e14883767cc9d3fb352574878.diff
LOG: [SVE] Fix incorrect usage of getNumElements() in InstCombineCalls
Summary:
Remove incorrect usage of getNumElements() from visitCallInst(). The
number of elements was being used to construct a DemandedElts bitfield.
This operation does not make sense for scalable vectors. Cast to
FixedVectorType
Identified by test case Clang :: CodeGen/aarch64-sve-intrinsics/acle_sve_mla.c
Reviewers: rengolin, efriedma, sdesmalen, c-rhodes, david-arm
Reviewed By: david-arm
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D79524
Added:
Modified:
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 2f79bc6a09a6..c57447d0c3f6 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1942,9 +1942,10 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
if (Changed) return II;
}
- // For vector result intrinsics, use the generic demanded vector support.
- if (auto *IIVTy = dyn_cast<VectorType>(II->getType())) {
- auto VWidth = IIVTy->getNumElements();
+ // For fixed width vector result intrinsics, use the generic demanded vector
+ // support.
+ if (auto *IIFVTy = dyn_cast<FixedVectorType>(II->getType())) {
+ auto VWidth = IIFVTy->getNumElements();
APInt UndefElts(VWidth, 0);
APInt AllOnesEltMask(APInt::getAllOnesValue(VWidth));
if (Value *V = SimplifyDemandedVectorElts(II, AllOnesEltMask, UndefElts)) {
More information about the llvm-commits
mailing list