[PATCH] D125504: [AArch64] Add `foldCSELOfCSEl` DAG combine

Karl Meakin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 08:08:40 PDT 2022


Kmeakin added a comment.

In D125504#3736490 <https://reviews.llvm.org/D125504#3736490>, @chapuni wrote:

> I was investigating this.
>
>   (CSEL l r EQ (CMP (CSEL x y cc2 cond) x)) => (CSEL l r cc2 cond)
>
> Could it be said as "Reduction of `(CMP(CSEL))`, regardless of outer `CSEL`"?

I suppose we could do that. Can you produce any tests that would benefit from a more generalised transform?

>   // Where x and y are constants
>
> I am dubious prerequisites. Is it sufficient?
>
>   cc = ((cc2 ? x : y) == x)
>
> This can be transformed to;
>
>   cc = (cc2 || y == x)
>
> I am afraid if correlation between x and y would be missed.
> I think such a transformation may be applied to `(CMP(CSEL(CMP)))`.

I am not sure I understand what you mean by this. Could you give an example?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125504



More information about the llvm-commits mailing list