[llvm] [MIR] Remove separate Size variable from parseMachineMemoryOperand. NFC (PR #101453)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 31 22:05:27 PDT 2024
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/101453
Size is updated in sync with MemoryType. Instead of maintaining a separate Size, use the size from MemoryType where needed.
>From 227c91b500f00adef41f9c4922378c917ea84916 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Wed, 31 Jul 2024 21:58:36 -0700
Subject: [PATCH] [MIR] Remove separate Size variable from
parseMachineMemoryOperand. NFC
Size is updated in sync with MemoryType. Instead of maintaining a
separate Size, use the size from MemoryType where needed.
---
llvm/lib/CodeGen/MIRParser/MIParser.cpp | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
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