[llvm] 72ed808 - [MIR] Remove separate Size variable from parseMachineMemoryOperand. NFC (#101453)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 31 22:57:48 PDT 2024
Author: Craig Topper
Date: 2024-07-31T22:57:45-07:00
New Revision: 72ed80866fcfe1366ab49995d23782e8566cec43
URL: https://github.com/llvm/llvm-project/commit/72ed80866fcfe1366ab49995d23782e8566cec43
DIFF: https://github.com/llvm/llvm-project/commit/72ed80866fcfe1366ab49995d23782e8566cec43.diff
LOG: [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.
Added:
Modified:
llvm/lib/CodeGen/MIRParser/MIParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index bf10794a100eb..0e2b71729fbf5 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -3362,15 +3362,15 @@ 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;
@@ -3378,7 +3378,6 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) {
MemoryType = LLT::scalar(8 * Size);
lex();
} else if (Token.is(MIToken::kw_unknown_size)) {
- Size = MemoryLocation::UnknownSize;
lex();
} else {
if (expectAndConsume(MIToken::lparen))
@@ -3387,8 +3386,6 @@ bool MIParser::parseMachineMemoryOperand(MachineMemOperand *&Dest) {
return true;
if (expectAndConsume(MIToken::rparen))
return true;
-
- Size = MemoryType.getSizeInBytes().getKnownMinValue();
}
MachinePointerInfo Ptr = MachinePointerInfo();
@@ -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)) {
More information about the llvm-commits
mailing list