Skip to content

[MIR] Remove separate Size variable from parseMachineMemoryOperand. NFC #101453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions llvm/lib/CodeGen/MIRParser/MIParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3362,23 +3362,22 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) {
if (parseOptionalAtomicOrdering(FailureOrder))
return true;

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

uint64_t Size = MemoryLocation::UnknownSize;
LLT MemoryType;
if (Token.is(MIToken::IntegerLiteral)) {
uint64_t Size;
if (getUint64(Size))
return true;

// Convert from bytes to bits for storage.
MemoryType = LLT::scalar(8 * Size);
lex();
} else if (Token.is(MIToken::kw_unknown_size)) {
Size = MemoryLocation::UnknownSize;
lex();
} else {
if (expectAndConsume(MIToken::lparen))
Expand All @@ -3387,8 +3386,6 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) {
return true;
if (expectAndConsume(MIToken::rparen))
return true;

Size = MemoryType.getSizeInBytes().getKnownMinValue();
}

MachinePointerInfo Ptr = MachinePointerInfo();
Expand All @@ -3406,7 +3403,9 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) {
return true;
}
uint64_t BaseAlignment =
(Size != MemoryLocation::UnknownSize ? PowerOf2Ceil(Size) : 1);
MemoryType.isValid()
? PowerOf2Ceil(MemoryType.getSizeInBytes().getKnownMinValue())
: 1;
AAMDNodes AAInfo;
MDNode *Range = nullptr;
while (consumeIfPresent(MIToken::comma)) {
Expand Down
Loading