diff options
author | Cullen Rhodes <cullen.rhodes@arm.com> | 2022-11-15 10:55:15 +0000 |
---|---|---|
committer | Cullen Rhodes <cullen.rhodes@arm.com> | 2022-11-15 11:59:07 +0000 |
commit | a290668ec5478e26d765a01d254b10d13c2a1dbd (patch) | |
tree | 129996efa3a578b52c0817c13a9c517adf4a1527 /clang/unittests/Tooling/CompilationDatabaseTest.cpp | |
parent | e292f9129126aea4823a46d4384871679f7987b6 (diff) | |
download | llvm-a290668ec5478e26d765a01d254b10d13c2a1dbd.zip llvm-a290668ec5478e26d765a01d254b10d13c2a1dbd.tar.gz llvm-a290668ec5478e26d765a01d254b10d13c2a1dbd.tar.bz2 |
[AArch64][SVE] Fix bad PTEST(X, X) optimization
AArch64InstrInfo::optimizePTestInstr attempts to remove a PTEST of a
predicate generating operation that identically sets flags (implictly).
When the mask is the same as the input predicate the PTEST is currently
removed. This is incorrect since the mask for the implicit PTEST
performed by the flag-setting instruction differs from the mask
specified to the explicit PTEST and could set different flags.
For example, consider
PG=<1, 1, x, x>
Z0=<1, 2, x, x>
Z1=<2, 1, x, x>
X=CMPLE(PG, Z0, Z1)
=<0, 1, x, x> NZCV=0xxx
PTEST(X, X), NZCV=1xxx
where the first active flag (bit 'N' in NZCV) is set by the explicit
PTEST, but not by the implicit PTEST as part of the compare. Given the
PTEST mask and source are the same however, first is equivalent to any,
so the PTEST could be removed if the condition is changed. The same
applies to last active. It is safe to remove the PTEST for any active,
but this information isn't available in the current optimization.
This patch fixes the bad optimization, a later patch will implement the
optimization proposed above and fix the any active case.
Reviewed By: bsmith
Differential Revision: https://reviews.llvm.org/D137717
Diffstat (limited to 'clang/unittests/Tooling/CompilationDatabaseTest.cpp')
0 files changed, 0 insertions, 0 deletions