[PATCH] D135633: [GlobalISel] Combine things like (z = x <= 0 ? z = x : z = 0) -> x & (x >> bw-1)

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 14:53:32 PDT 2022


paquette added a comment.

In D135633#3856871 <https://reviews.llvm.org/D135633#3856871>, @arsenm wrote:

> In D135633#3856846 <https://reviews.llvm.org/D135633#3856846>, @paquette wrote:
>
>> Split into two combines to avoid the hook. The "and-not" combine is now opt-in by the target.
>
> If someone needed different behavior per type, it would still need a hook (or some other mechanism to parameterize combines by type)

Should I add the hook back in then?



================
Comment at: llvm/include/llvm/CodeGen/TargetLowering.h:724-731
+  virtual bool hasAndNotCompare(LLT Ty) const { return false; }
+
+  /// LLT variant
+  virtual bool hasAndNot(LLT Ty) const {
+    // If the target has the more complex version of this operation, assume that
+    // it has this operation too.
+    return hasAndNotCompare(Ty);
----------------
aemerson wrote:
> arsenm wrote:
> > Wouldn't the target just not add this combine if it didn't want it?
> @paquette Echoing Matt's question: is this hook actually needed?
yeah I can drop it


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

https://reviews.llvm.org/D135633



More information about the llvm-commits mailing list