commit | e8fab0892f0fec0530fda89944e738522b340512 | [log] [tgz] |
---|---|---|
author | Tobias Stadler <mail@stadler-tobias.de> | Fri Sep 29 02:11:16 2023 +0200 |
committer | Copybara-Service <copybara-worker@google.com> | Thu Sep 28 17:22:41 2023 -0700 |
tree | 81a10ac1d5327e7373c09b51902c85e8027a3ca0 | |
parent | 43e312cfc61435c720fa0c51c84b24fa4cf4488d [diff] |
[GlobalISel] LegalizationArtifactCombiner: Elide redundant G_AND The legalizer currently generates lots of G_AND artifacts. For example between boolean uses and defs there is always a G_AND with a mask of 1, but when the target uses ZeroOrOneBooleanContents, this is unnecessary. Currently these artifacts have to be removed using post-legalize combines. Omitting these artifacts at their source in the artifact combiner has a few advantages: - We know that the emitted G_AND is very likely to be useless, so our KnownBits call is likely worth it. - The G_AND and G_CONSTANT can interrupt e.g. G_UADDE/... sequences generated during legalization of wide adds which makes it harder to detect these sequences in the instruction selector (e.g. useful to prevent unnecessary reloading of AArch64 NZCV register). - This cleans up a lot of legalizer output and even improves compilation-times. AArch64 CTMark geomean: `O0` -5.6% size..text; `O0` and `O3` ~-0.9% compilation-time (instruction count). Since this introduces KnownBits into code-paths used by `O0`, I reduced the default recursion depth. This doesn't seem to make a difference in CTMark, but should prevent excessive recursive calls in the worst case. Reviewed By: aemerson Differential Revision: https://reviews.llvm.org/D159140 GitOrigin-RevId: 3686a0b611c65f0d7190345b8e3e73cdca9fa657