[PATCH] D46278: [AArch64] Fold B = csel A, A into B = COPY A
Jon Roelofs via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 28 11:25:13 PDT 2021
jroelofs added inline comments.
================
Comment at: llvm/test/CodeGen/AArch64/srem-seteq.ll:272
; CHECK: // %bb.0:
-; CHECK-NEXT: cmp w0, #0 // =0
-; CHECK-NEXT: csel w8, w0, w0, lt
-; CHECK-NEXT: cmp w0, w8
+; CHECK-NEXT: cmp w0, w0
; CHECK-NEXT: cset w0, eq
----------------
jroelofs wrote:
> dmgreen wrote:
> > I think it's worth fixing this in ISel. The whole thing should be `mov x0, 1`, which the further simplification during DAG combine will simplify to so long as it doesn't get caught up on the CSEL.
> >
> > I presume the same sort of thing could easily be done in GlobalISel.
> >
> > Are there other cases motivating this patch?
> Yes, I have seen a few of the trivial matching-operands-fcsel case in the test-suite. Let me try to reduce one of them.
https://clang.godbolt.org/z/WvnrcrGEn
`fcsel d4, d3, d3, eq`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D46278/new/
https://reviews.llvm.org/D46278
More information about the llvm-commits
mailing list