Skip to content

Commit 72ed808

Browse files
authored
[MIR] Remove separate Size variable from parseMachineMemoryOperand. NFC (#101453)
Size is updated in sync with MemoryType. Instead of maintaining a separate Size, use the size from MemoryType where needed.
1 parent 86815a1 commit 72ed808

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/CodeGen/MIRParser/MIParser.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3362,23 +3362,22 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) {
33623362
if (parseOptionalAtomicOrdering(FailureOrder))
33633363
return true;
33643364

3365-
LLT MemoryType;
33663365
if (Token.isNot(MIToken::IntegerLiteral) &&
33673366
Token.isNot(MIToken::kw_unknown_size) &&
33683367
Token.isNot(MIToken::lparen))
33693368
return error("expected memory LLT, the size integer literal or 'unknown-size' after "
33703369
"memory operation");
33713370

3372-
uint64_t Size = MemoryLocation::UnknownSize;
3371+
LLT MemoryType;
33733372
if (Token.is(MIToken::IntegerLiteral)) {
3373+
uint64_t Size;
33743374
if (getUint64(Size))
33753375
return true;
33763376

33773377
// Convert from bytes to bits for storage.
33783378
MemoryType = LLT::scalar(8 * Size);
33793379
lex();
33803380
} else if (Token.is(MIToken::kw_unknown_size)) {
3381-
Size = MemoryLocation::UnknownSize;
33823381
lex();
33833382
} else {
33843383
if (expectAndConsume(MIToken::lparen))
@@ -3387,8 +3386,6 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) {
33873386
return true;
33883387
if (expectAndConsume(MIToken::rparen))
33893388
return true;
3390-
3391-
Size = MemoryType.getSizeInBytes().getKnownMinValue();
33923389
}
33933390

33943391
MachinePointerInfo Ptr = MachinePointerInfo();
@@ -3406,7 +3403,9 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) {
34063403
return true;
34073404
}
34083405
uint64_t BaseAlignment =
3409-
(Size != MemoryLocation::UnknownSize ? PowerOf2Ceil(Size) : 1);
3406+
MemoryType.isValid()
3407+
? PowerOf2Ceil(MemoryType.getSizeInBytes().getKnownMinValue())
3408+
: 1;
34103409
AAMDNodes AAInfo;
34113410
MDNode *Range = nullptr;
34123411
while (consumeIfPresent(MIToken::comma)) {

0 commit comments

Comments
 (0)