[PATCH] D119075: [DAGCombine][ARM] Custom lower smaller-than-legal MULH/AVG/ABD

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 7 10:26:33 PST 2022


efriedma added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:8775-8777
   // Combine to mulh if mulh is legal/custom for the narrow type on the target.
-  if (!TLI.isOperationLegalOrCustom(MulhOpcode, NarrowVT))
+  if (!TLI.isOperationLegal(MulhOpcode, NarrowVT) &&
+      !TLI.isOperationCustom(MulhOpcode, NarrowVT))
----------------
I think the predicate you actually need here is something like `!TLI.isOperationLegalOrCustom(MulhOpcode, NarrowVT) && (LegalTypes || !TLI.isOperationCustom(MulhOpcode, NarrowVT))`.  i.e. before type legalization, allow custom lowering.  After type legalization, only allow custom lowering if the type is legal.

Constructing an operator with an illegal type after type legalization is likely to crash the compiler.


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

https://reviews.llvm.org/D119075



More information about the llvm-commits mailing list