[all-commits] [llvm/llvm-project] e59f02: [GlobalISel] Translate <1 x N> getelementptrs to s...
Jessica Paquette via All-commits
all-commits at lists.llvm.org
Thu Jul 1 16:39:55 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e59f02216f1c6972925c5ef0f1df6d434c652c69
https://github.com/llvm/llvm-project/commit/e59f02216f1c6972925c5ef0f1df6d434c652c69
Author: Jessica Paquette <jpaquette at apple.com>
Date: 2021-07-01 (Thu, 01 Jul 2021)
Changed paths:
M llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
A llvm/test/CodeGen/AArch64/GlobalISel/irtranslator-one-by-n-vector-ptr-add.ll
Log Message:
-----------
[GlobalISel] Translate <1 x N> getelementptrs to scalar G_PTR_ADDs
In `IRTranslator::translateGetElementPtr`, when we run into a vector gep with
some scalar operands, we try to normalize those operands using
`buildSplatVector`.
This is fine except for when the getelementptr has a <1 x N> type. In that case
it is treated as a scalar. If we run into one of these then every call to
```
// With VectorWidth = 1
LLT::fixed_vector(VectorWidth, PtrTy)
```
will assert.
Here's an example (equivalent to the added testcase):
https://godbolt.org/z/hGsTnMYdW
To get around this, this patch adds a variable, `WantSplatVector`, which
is true when our vector type ought to actually be represented using a vector.
When it's false, we'll translate as a scalar. This checks if `VectorWidth > 1`.
This fixes this bug:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35496
Differential Revision: https://reviews.llvm.org/D105316
More information about the All-commits
mailing list