[PATCH] D46278: [AArch64] Fold B = csel A, A into B = COPY A

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 16:07:52 PDT 2021


dmgreen 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
----------------
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?


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