[PATCH] D139691: [PowerPC] add a peephole to remove redundant swap instructions after vector splats on P8

Ting Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 5 17:46:11 PST 2023


tingwang added a comment.

In D139691#4102735 <https://reviews.llvm.org/D139691#4102735>, @nemanjai wrote:

> Why do we need this?
>
> 1. For LE, why doesn't the swap removal pass remove the swaps rather than relying on this peephole?
> 2. For AIX, why do we have swaps? We certainly don't swap values we store by default on big endian, so the description of this doesn't explain it at all.

Hi Nemanja,

This scenario indirectly originated from D138883 <https://reviews.llvm.org/D138883>. These additional swaps observed on LE were not removed by `ppc-vsx-swaps` pass due to its limitations. Since the instruction combination is clear and simple, I weighted peephole a more reliable approach to remove these swaps than `ppc-vsx-swaps` pass. (IMHO, it cost more to fix in `ppc-vsx-swaps` pass, not even mention that `ppc-vsx-swaps` pass sometimes backfires and creates more swaps. I'm a little bit worried that enabling more patterns in `ppc-vsx-swaps` pass may cause it backfire at me...)

This was intended for LE, and all pattern changes here are related to LE. Sorry I should have high lighted this point, and will provider more information in the description.

By the way, thank you for providing help on D138883 <https://reviews.llvm.org/D138883>. As you suggested, I realized `canCombineStoreAndExtract()` could be used for the purpose, and did extend the API. Not sure if that serves the purpose well or not?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139691/new/

https://reviews.llvm.org/D139691



More information about the llvm-commits mailing list