[llvm] [AArch64] Improve index selection for histograms (PR #111150)

James Chesterman via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 8 02:24:15 PDT 2024


================
@@ -24079,12 +24080,29 @@ static bool findMoreOptimalIndexType(const MaskedGatherScatterSDNode *N,
 
 static SDValue performMaskedGatherScatterCombine(
     SDNode *N, TargetLowering::DAGCombinerInfo &DCI, SelectionDAG &DAG) {
-  MaskedGatherScatterSDNode *MGS = cast<MaskedGatherScatterSDNode>(N);
-  assert(MGS && "Can only combine gather load or scatter store nodes");
-
   if (!DCI.isBeforeLegalize())
     return SDValue();
 
+  if (N->getOpcode() == ISD::EXPERIMENTAL_VECTOR_HISTOGRAM) {
+    MaskedHistogramSDNode *HG = cast<MaskedHistogramSDNode>(N);
+
+    SDValue Index = HG->getIndex();
+    if (!ISD::isExtOpcode(Index->getOpcode())) {
+      return SDValue();
+    } else {
----------------
JamesChesterman wrote:

Done

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


More information about the llvm-commits mailing list