aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
authorEli Friedman <efriedma@quicinc.com>2020-03-31 13:08:59 -0700
committerEli Friedman <efriedma@quicinc.com>2020-03-31 13:08:59 -0700
commit1ee6ec2bf370fbd1d93f34c8b56741a9d3f22ed2 (patch)
treeb9623492ad0fb566cfa38ee8d99d538b95ba8c3e /llvm/lib/Analysis/ValueTracking.cpp
parentc538c57d6dae548e644449352d9350d58be9a4af (diff)
downloadllvm-1ee6ec2bf370fbd1d93f34c8b56741a9d3f22ed2.zip
llvm-1ee6ec2bf370fbd1d93f34c8b56741a9d3f22ed2.tar.gz
llvm-1ee6ec2bf370fbd1d93f34c8b56741a9d3f22ed2.tar.bz2
Remove "mask" operand from shufflevector.
Instead, represent the mask as out-of-line data in the instruction. This should be more efficient in the places that currently use getShuffleVector(), and paves the way for further changes to add new shuffles for scalable vectors. This doesn't change the syntax in textual IR. And I don't currently plan to change the bitcode encoding in this patch, although we'll probably need to do something once we extend shufflevector for scalable types. I expect that once this is finished, we can then replace the raw "mask" with something more appropriate for scalable vectors. Not sure exactly what this looks like at the moment, but there are a few different ways we could handle it. Maybe we could try to describe specific shuffles. Or maybe we could define it in terms of a function to convert a fixed-length array into an appropriate scalable vector, using a "step", or something like that. Differential Revision: https://reviews.llvm.org/D72467
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 0075130..6a4d596 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -168,16 +168,16 @@ static bool getShuffleDemandedElts(const ShuffleVectorInst *Shuf,
APInt &DemandedLHS, APInt &DemandedRHS) {
// The length of scalable vectors is unknown at compile time, thus we
// cannot check their values
- if (Shuf->getMask()->getType()->getVectorElementCount().Scalable)
+ if (Shuf->getType()->getVectorElementCount().Scalable)
return false;
int NumElts = Shuf->getOperand(0)->getType()->getVectorNumElements();
- int NumMaskElts = Shuf->getMask()->getType()->getVectorNumElements();
+ int NumMaskElts = Shuf->getType()->getVectorNumElements();
DemandedLHS = DemandedRHS = APInt::getNullValue(NumElts);
if (DemandedElts.isNullValue())
return true;
// Simple case of a shuffle with zeroinitializer.
- if (isa<ConstantAggregateZero>(Shuf->getMask())) {
+ if (all_of(Shuf->getShuffleMask(), [](int Elt) { return Elt == 0; })) {
DemandedLHS.setBit(0);
return true;
}