[Alignment][NFC] Use Align in MCSymbol::declareCommon
authorGuillaume Chatelet <gchatelet@google.com>
Mon, 12 Dec 2022 14:27:55 +0000 (14:27 +0000)
committerGuillaume Chatelet <gchatelet@google.com>
Mon, 12 Dec 2022 14:29:04 +0000 (14:29 +0000)
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

index f6f051d..8954960 100644 (file)
@@ -370,14 +370,14 @@ public:
   /// \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 different 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;
   }
 
index e3db13e..380576f 100644 (file)
@@ -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 different type");
   }
index 473822f..64c3ea6 100644 (file)
@@ -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 different type");
   }
index cdf4d25..13ff932 100644 (file)
@@ -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 different type");
     if ((AccessSize) && (Size <= GPSize)) {