[llvm] [AArch64] Combine undef UZP and NVCAST away. (PR #204623)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 03:20:41 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;
----------------
paulwalker-arm wrote:

Up to you but perhaps it's worth swapping these so we only try to create/lookup an UNDEF when needed?

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


More information about the llvm-commits mailing list