[llvm] 070bc71 - [Alignment][NFC] Use Align in MCSymbol::declareCommon
Guillaume Chatelet via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 12 06:29:17 PST 2022
Author: Guillaume Chatelet
Date: 2022-12-12T14:29:04Z
New Revision: 070bc7183047439943be5a9e917bb2c18215c214
URL: https://github.com/llvm/llvm-project/commit/070bc7183047439943be5a9e917bb2c18215c214
DIFF: https://github.com/llvm/llvm-project/commit/070bc7183047439943be5a9e917bb2c18215c214.diff
LOG: [Alignment][NFC] Use Align in MCSymbol::declareCommon
Added:
Modified:
llvm/include/llvm/MC/MCSymbol.h
llvm/lib/MC/MCELFStreamer.cpp
llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCSymbol.h b/llvm/include/llvm/MC/MCSymbol.h
index f6f051d55dc1b..8954960e3b8c7 100644
--- a/llvm/include/llvm/MC/MCSymbol.h
+++ b/llvm/include/llvm/MC/MCSymbol.h
@@ -370,14 +370,14 @@ class MCSymbol {
/// \param Alignment - The alignment of the symbol.
/// \param Target - Is the symbol a target-specific common-like symbol.
/// \return True if symbol was already declared as a
diff erent type
- bool declareCommon(uint64_t Size, unsigned Alignment, bool Target = false) {
+ bool declareCommon(uint64_t Size, Align Alignment, bool Target = false) {
assert(isCommon() || getOffset() == 0);
if(isCommon()) {
- if (CommonSize != Size || getCommonAlignment() != Align(Alignment) ||
+ if (CommonSize != Size || getCommonAlignment() != Alignment ||
isTargetCommon() != Target)
return true;
} else
- setCommon(Size, Align(Alignment), Target);
+ setCommon(Size, Alignment, Target);
return false;
}
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index e3db13ee54746..380576f4b78b4 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -331,7 +331,7 @@ void MCELFStreamer::emitCommonSymbol(MCSymbol *S, uint64_t Size,
switchSection(P.first, P.second);
} else {
- if (Symbol->declareCommon(Size, ByteAlignment.value()))
+ if (Symbol->declareCommon(Size, ByteAlignment))
report_fatal_error(Twine("Symbol: ") + Symbol->getName() +
" redeclared as
diff erent type");
}
diff --git a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
index 473822fdcdd5f..64c3ea6693c1c 100644
--- a/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
+++ b/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
@@ -742,7 +742,7 @@ void AMDGPUTargetELFStreamer::emitAMDGPULDS(MCSymbol *Symbol, unsigned Size,
SymbolELF->setExternal(true);
}
- if (SymbolELF->declareCommon(Size, Alignment.value(), true)) {
+ if (SymbolELF->declareCommon(Size, Alignment, true)) {
report_fatal_error("Symbol: " + Symbol->getName() +
" redeclared as
diff erent type");
}
diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
index cdf4d25aeacec..13ff9327ec031 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
@@ -121,7 +121,7 @@ void HexagonMCELFStreamer::HexagonMCEmitCommonSymbol(MCSymbol *Symbol,
switchSection(P.first, P.second);
} else {
- if (ELFSymbol->declareCommon(Size, ByteAlignment))
+ if (ELFSymbol->declareCommon(Size, Align(ByteAlignment)))
report_fatal_error("Symbol: " + Symbol->getName() +
" redeclared as
diff erent type");
if ((AccessSize) && (Size <= GPSize)) {
More information about the llvm-commits
mailing list