[llvm] 6280cab - [NFC] Use GlobalObject::setAlignment that takes an Align in LLParser

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 1 01:14:34 PST 2023


Author: Guillaume Chatelet
Date: 2023-02-01T09:14:23Z
New Revision: 6280cab0fe21682acd048e817f6b3d7c0590944a

URL: https://github.com/llvm/llvm-project/commit/6280cab0fe21682acd048e817f6b3d7c0590944a
DIFF: https://github.com/llvm/llvm-project/commit/6280cab0fe21682acd048e817f6b3d7c0590944a.diff

LOG: [NFC] Use GlobalObject::setAlignment that takes an Align in LLParser

Added: 
    

Modified: 
    llvm/lib/AsmParser/LLParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 65b5825f63230..f23e5f45a661a 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -1306,7 +1306,8 @@ bool LLParser::parseGlobal(const std::string &Name, LocTy NameLoc,
       MaybeAlign Alignment;
       if (parseOptionalAlignment(Alignment))
         return true;
-      GV->setAlignment(Alignment);
+      if (Alignment)
+        GV->setAlignment(*Alignment);
     } else if (Lex.getKind() == lltok::MetadataVar) {
       if (parseGlobalObjectMetadataAttachment(*GV))
         return true;
@@ -6047,7 +6048,8 @@ bool LLParser::parseFunctionHeader(Function *&Fn, bool IsDefine) {
   Fn->setCallingConv(CC);
   Fn->setAttributes(PAL);
   Fn->setUnnamedAddr(UnnamedAddr);
-  Fn->setAlignment(Alignment);
+  if (Alignment)
+    Fn->setAlignment(*Alignment);
   Fn->setSection(Section);
   Fn->setPartition(Partition);
   Fn->setComdat(C);


        


More information about the llvm-commits mailing list