[llvm] [AArch64] Avoid creating a new generic constant in SelectSMETileSlice (PR #203344)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 06:23:02 PDT 2026
================
@@ -5032,6 +5032,15 @@ bool AArch64DAGToDAGISel::trySelectXAR(SDNode *N) {
return true;
}
+/// Returns a copy from WZR or XZR. This can be used during instruction
+/// selection (it does not require any further selection/legalization).
+static SDValue getZeroRegister(SelectionDAG &DAG, SDLoc DL, EVT VT) {
+ if (VT == MVT::i32)
+ return DAG.getCopyFromReg(DAG.getEntryNode(), DL, AArch64::WZR, MVT::i32);
+ assert(VT == MVT::i64);
+ return DAG.getCopyFromReg(DAG.getEntryNode(), DL, AArch64::XZR, MVT::i64);
----------------
sdesmalen-arm wrote:
very minor nit:
```suggestion
assert(VT == MVT::i32 || VT == MVT::i64);
return DAG.getCopyFromReg(DAG.getEntryNode(), DL,
VT == MVT::i32 ? AArch64::WZR : AArch64::XZR, VT);
```
https://github.com/llvm/llvm-project/pull/203344
More information about the llvm-commits
mailing list