Skip to content

Commit 07d5584

Browse files
committed
Change MulImm to std::optional<int64_t> (NFC)
I think making `MulImm` std::optional helps make the intent of the if-else chain clearer. If anyone doesn't agree please let me know and I'll undo this.
1 parent 25cee06 commit 07d5584

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7380,7 +7380,7 @@ bool AArch64DAGToDAGISel::SelectAddrModeIndexedSVE(SDNode *Root, SDValue N,
73807380
return false;
73817381

73827382
SDValue VScale = N.getOperand(1);
7383-
int64_t MulImm = std::numeric_limits<int64_t>::max();
7383+
std::optional<int64_t> MulImm;
73847384
if (VScale.getOpcode() == ISD::VSCALE) {
73857385
MulImm = cast<ConstantSDNode>(VScale.getOperand(0))->getSExtValue();
73867386
} else if (auto C = dyn_cast<ConstantSDNode>(VScale)) {
@@ -7396,16 +7396,15 @@ bool AArch64DAGToDAGISel::SelectAddrModeIndexedSVE(SDNode *Root, SDValue N,
73967396
} else
73977397
return false;
73987398

7399-
assert(MulImm != std::numeric_limits<int64_t>::max() &&
7400-
"Uninitialized MulImm.");
7399+
assert(MulImm && "Uninitialized MulImm.");
74017400

74027401
TypeSize TS = MemVT.getSizeInBits();
74037402
int64_t MemWidthBytes = static_cast<int64_t>(TS.getKnownMinValue()) / 8;
74047403

7405-
if ((MulImm % MemWidthBytes) != 0)
7404+
if ((*MulImm % MemWidthBytes) != 0)
74067405
return false;
74077406

7408-
int64_t Offset = MulImm / MemWidthBytes;
7407+
int64_t Offset = *MulImm / MemWidthBytes;
74097408
if (Offset < Min || Offset > Max)
74107409
return false;
74117410

0 commit comments

Comments
 (0)