[NFC] Use GlobalObject::setAlignment that takes an Align in LLParser
authorGuillaume Chatelet <gchatelet@google.com>
Wed, 1 Feb 2023 09:13:57 +0000 (09:13 +0000)
committerGuillaume Chatelet <gchatelet@google.com>
Wed, 1 Feb 2023 09:14:23 +0000 (09:14 +0000)
llvm/lib/AsmParser/LLParser.cpp

index 65b5825..f23e5f4 100644 (file)
@@ -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);