aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ConstantFolding.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/ConstantFolding.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/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index 5efebe2..721ba73 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1066,7 +1066,8 @@ Constant *ConstantFoldInstOperandsImpl(const Value *InstOrCE, unsigned Opcode,
case Instruction::InsertElement:
return ConstantExpr::getInsertElement(Ops[0], Ops[1], Ops[2]);
case Instruction::ShuffleVector:
- return ConstantExpr::getShuffleVector(Ops[0], Ops[1], Ops[2]);
+ return ConstantExpr::getShuffleVector(
+ Ops[0], Ops[1], cast<ShuffleVectorInst>(InstOrCE)->getShuffleMask());
}
}