[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
Thu Apr 29 10:24:43 PDT 2021


dmgreen added a comment.

> 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.

Oh yeah. IfCvt and CSE working together I see. It always feels odd for llvm to very carefully not hoist a fdiv out of an block, just for the backend to do it anyway :)

> Since the source of these seems to be early-ifcvt, maybe it's better to solve this problem there?

Sounds good to me.

I may put up a patch for the case that can be fixed in ISel too, because it should be super simple (and there's already a test case!)



================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.cpp:920
+    if (TrueDef && FalseDef)
+      return TrueDef == FalseDef;
+
----------------
jroelofs wrote:
> I found a case that throws a wrench in this strategy:
> 
> ```
> early-clobber %66:gpr64common, %67:gpr64 = LDRXpre %38:gpr64common(tied-def 0), 16
> %74:gpr64 = CSELXr killed %67:gpr64, %66:gpr64common, 11, implicit $nzcv
> 
> ```
Does that apply to D101508 too?


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