[llvm] [AArch64][SVE] Add partial reduction SDNodes (PR #117185)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 21 08:59:29 PST 2024


================
@@ -2452,6 +2452,12 @@ SDValue SelectionDAG::getShiftAmountOperand(EVT LHSTy, SDValue Op) {
   return getZExtOrTrunc(Op, SDLoc(Op), ShTy);
 }
 
+SDValue SelectionDAG::getPartialReduceAddSDNode(SDLoc DL, SDValue Chain,
+                                                SDValue Acc, SDValue Input) {
+  return getNode(ISD::PARTIAL_REDUCE_ADD, DL, Acc.getValueType(), Chain, Acc,
+                 Input);
----------------
MacDue wrote:

I think this is just constructing a plain `SDNode *` (not a `PartialReduceAddSDNode *`), which I think would technically make the `auto *PR = cast<PartialReduceAddSDNode>(N)` later on UB (might fail with `-DLLVM_USE_SANITIZER=Undefined`), even though the layout of both classes is the same.

I think to use your custom class would be: `newSDNode<PartialReduceAddSDNode>(...)`.

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


More information about the llvm-commits mailing list