[llvm] [DAGCombiner] Add support for scalarising extracts of a vector setcc (PR #116031)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 20:01:34 PST 2024


================
@@ -3334,6 +3334,10 @@ class TargetLoweringBase {
     return false;
   }
 
+  /// Try to convert an extract element of a vector setcc operation into an
+  /// extract element followed by a scalar operation.
+  virtual bool shouldScalarizeSetCC(SDValue VecOp) const { return false; }
----------------
arsenm wrote:

I haven't looked at the context that closely, but we need way fewer points of configuration. The ones we do have should be much more general. This stuff is not discoverable by backend maintainers, and is high effort to find and implement. But consider this a hard -1 on adding a new super specific thing. If a target hook as no arguments, it's a major code smell.

But yes, shouldScalarizeBinOp would be preferable. The changing result type probably doesn't matter in practice, it's approximately fixed per target 

https://github.com/llvm/llvm-project/pull/116031


More information about the llvm-commits mailing list