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

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 09:37:47 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 {
----------------
MacDue wrote:

Don't use `else` after a `return` (see: https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return) :slightly_smiling_face: 

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


More information about the llvm-commits mailing list