diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/IR/Globals.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/LTO/LTO.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/OpenMPOpt.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 2 |
5 files changed, 6 insertions, 15 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 65b5825..7f45162 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -150,7 +150,7 @@ bool LLParser::validateEndOfModule(bool UpgradeDebugInfo) { // If the alignment was parsed as an attribute, move to the alignment // field. if (MaybeAlign A = FnAttrs.getAlignment()) { - Fn->setAlignment(*A); + Fn->setAlignment(A); FnAttrs.removeAttribute(Attribute::Alignment); } @@ -6047,7 +6047,7 @@ bool LLParser::parseFunctionHeader(Function *&Fn, bool IsDefine) { Fn->setCallingConv(CC); Fn->setAttributes(PAL); Fn->setUnnamedAddr(UnnamedAddr); - Fn->setAlignment(Alignment); + Fn->setAlignment(MaybeAlign(Alignment)); Fn->setSection(Section); Fn->setPartition(Partition); Fn->setComdat(C); diff --git a/llvm/lib/IR/Globals.cpp b/llvm/lib/IR/Globals.cpp index 275ac25..c208ab0 100644 --- a/llvm/lib/IR/Globals.cpp +++ b/llvm/lib/IR/Globals.cpp @@ -127,16 +127,6 @@ void GlobalObject::setAlignment(MaybeAlign Align) { assert(getAlign() == Align && "Alignment representation error!"); } -void GlobalObject::setAlignment(Align Align) { - assert(Align <= MaximumAlignment && - "Alignment is greater than MaximumAlignment!"); - unsigned AlignmentData = encode(Align); - unsigned OldData = getGlobalValueSubClassData(); - setGlobalValueSubClassData((OldData & ~AlignmentMask) | AlignmentData); - assert(getAlign() && *getAlign() == Align && - "Alignment representation error!"); -} - void GlobalObject::copyAttributesFrom(const GlobalObject *Src) { GlobalValue::copyAttributesFrom(Src); setAlignment(Src->getAlign()); diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 7920481..1cd48ad 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/lib/LTO/LTO.cpp @@ -839,7 +839,8 @@ LTO::addRegularLTO(BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms, auto &CommonRes = RegularLTO.Commons[std::string(Sym.getIRName())]; CommonRes.Size = std::max(CommonRes.Size, Sym.getCommonSize()); if (uint32_t SymAlignValue = Sym.getCommonAlignment()) { - CommonRes.Align = std::max(Align(SymAlignValue), CommonRes.Align); + const Align SymAlign(SymAlignValue); + CommonRes.Align = std::max(SymAlign, CommonRes.Align.valueOrOne()); } CommonRes.Prevailing |= Res.Prevailing; } diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp index 0f18d41..677cd27 100644 --- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp @@ -3300,7 +3300,7 @@ struct AAHeapToSharedFunction : public AAHeapToShared { MaybeAlign Alignment = CB->getRetAlign(); assert(Alignment && "HeapToShared on allocation without alignment attribute"); - SharedMem->setAlignment(*Alignment); + SharedMem->setAlignment(MaybeAlign(Alignment)); A.changeAfterManifest(IRPosition::callsite_returned(*CB), *NewBuffer); A.deleteAfterManifest(*CB); diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 1d013f0..6502e13 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -2306,7 +2306,7 @@ bool ModuleAddressSanitizer::InstrumentGlobals(IRBuilder<> &IRB, Module &M, G->getThreadLocalMode(), G->getAddressSpace()); NewGlobal->copyAttributesFrom(G); NewGlobal->setComdat(G->getComdat()); - NewGlobal->setAlignment(Align(getMinRedzoneSizeForGlobal())); + NewGlobal->setAlignment(MaybeAlign(getMinRedzoneSizeForGlobal())); // Don't fold globals with redzones. ODR violation detector and redzone // poisoning implicitly creates a dependence on the global's address, so it // is no longer valid for it to be marked unnamed_addr. |