[clang] [llvm] [AArch64][SVE] Improve fixed-length addressing modes. (PR #129732)
Paul Walker via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 5 05:01:55 PST 2025
================
@@ -7380,12 +7380,26 @@ bool AArch64DAGToDAGISel::SelectAddrModeIndexedSVE(SDNode *Root, SDValue N,
return false;
SDValue VScale = N.getOperand(1);
- if (VScale.getOpcode() != ISD::VSCALE)
+ int64_t MulImm = std::numeric_limits<int64_t>::max();
+ if (VScale.getOpcode() == ISD::VSCALE) {
+ MulImm = cast<ConstantSDNode>(VScale.getOperand(0))->getSExtValue();
+ } else if (auto C = dyn_cast<ConstantSDNode>(VScale)) {
+ int64_t ByteOffset = C->getSExtValue();
+ const auto KnownVScale =
+ Subtarget->getSVEVectorSizeInBits() / AArch64::SVEBitsPerBlock;
+
+ if (!KnownVScale || ByteOffset % KnownVScale != 0)
+ return false;
+
+ MulImm = ByteOffset / KnownVScale;
+ } else
return false;
+ assert(MulImm != std::numeric_limits<int64_t>::max() &&
+ "Uninitialized MulImm.");
+
----------------
paulwalker-arm wrote:
This is not strictly true given you are initialising `MulImm` and whilst unlikely there's nothing stopping `ISD::VSCALE`'s operand from being `std::numeric_limits<int64_t>::max()`.
Given the following code will bail if `MulImm` is not changed from its initial value, you could just remove the assert?
https://github.com/llvm/llvm-project/pull/129732
More information about the cfe-commits
mailing list