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

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 03:03:17 PDT 2024


================
@@ -24079,12 +24080,32 @@ 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);
+    assert(HG &&
+           "Can only combine gather load, scatter store or histogram nodes");
----------------
MacDue wrote:

I think the `assert` after `cast<T>` is redundant (`cast` asserts internally)

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


More information about the llvm-commits mailing list