aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/InterleavedAccessPass.cpp
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2023-03-31 15:38:27 +0100
committerDavid Green <david.green@arm.com>2023-03-31 15:38:27 +0100
commit7b6fae42f7046d27218d724892963377b2acfd45 (patch)
tree0b035cda98a454d3cf7e07458cfc8d710b6cff73 /llvm/lib/CodeGen/InterleavedAccessPass.cpp
parent6261adfa51f2d93c8258e7b2d9811d607f3e50a5 (diff)
downloadllvm-7b6fae42f7046d27218d724892963377b2acfd45.zip
llvm-7b6fae42f7046d27218d724892963377b2acfd45.tar.gz
llvm-7b6fae42f7046d27218d724892963377b2acfd45.tar.bz2
[InterleaveAccess] Check that binop shuffles have an undef second operand
It is expected that shuffles that we hoist through binops only have a single vector operand, the other being undef/poison. The checks for isDeInterleaveMaskOfFactor check that all the elements come from inside the first vector, but with non-canonical shuffles the second operand could still have a value. Add a quick check to make sure it is UndefValue as expected, to make sure we don't run into problems with BinOpShuffles not using BinOps. Fixes #61749 Differential Revision: https://reviews.llvm.org/D147306
Diffstat (limited to 'llvm/lib/CodeGen/InterleavedAccessPass.cpp')
-rw-r--r--llvm/lib/CodeGen/InterleavedAccessPass.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/InterleavedAccessPass.cpp b/llvm/lib/CodeGen/InterleavedAccessPass.cpp
index 95c4faf..a65fafc4 100644
--- a/llvm/lib/CodeGen/InterleavedAccessPass.cpp
+++ b/llvm/lib/CodeGen/InterleavedAccessPass.cpp
@@ -240,8 +240,10 @@ bool InterleavedAccess::lowerInterleavedLoad(
continue;
}
if (auto *BI = dyn_cast<BinaryOperator>(User)) {
- if (all_of(BI->users(),
- [](auto *U) { return isa<ShuffleVectorInst>(U); })) {
+ if (all_of(BI->users(), [](auto *U) {
+ auto *SVI = dyn_cast<ShuffleVectorInst>(U);
+ return SVI && isa<UndefValue>(SVI->getOperand(1));
+ })) {
for (auto *SVI : BI->users())
BinOpShuffles.insert(cast<ShuffleVectorInst>(SVI));
continue;