[llvm] [AArch64] Combine undef UZP and NVCAST away. (PR #204623)
Gaƫtan Bossu via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 3 01:30:50 PDT 2026
================
@@ -28710,11 +28716,17 @@ static SDValue performDUPCombine(SDNode *N,
/// Get rid of unnecessary NVCASTs (that don't change the type).
static SDValue performNVCASTCombine(SDNode *N, SelectionDAG &DAG) {
- if (N->getValueType(0) == N->getOperand(0).getValueType())
- return N->getOperand(0);
- if (N->getOperand(0).getOpcode() == AArch64ISD::NVCAST)
- return DAG.getNode(AArch64ISD::NVCAST, SDLoc(N), N->getValueType(0),
- N->getOperand(0).getOperand(0));
+ EVT VT = N->getValueType(0);
+ SDValue Op = N->getOperand(0);
+
+ if (Op.isUndef())
+ return DAG.getUNDEF(VT);
+
+ if (VT == Op.getValueType())
+ return Op;
----------------
gbossu wrote:
If the types are the same, I think the DAG would be identical due to the internal caching of SDNode inside SDAG, but I agree this reads nicer. Changed.
https://github.com/llvm/llvm-project/pull/204623
More information about the llvm-commits
mailing list