aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorGuillaume Chatelet <gchatelet@google.com>2022-06-18 14:34:11 +0000
committerGuillaume Chatelet <gchatelet@google.com>2022-06-20 08:37:48 +0000
commitf1255186c7c4a631c051e05ed12ea79ed091141d (patch)
tree7fe7660560cbfd5bc5ddb8642f0307849354c213 /llvm/lib/LTO/LTO.cpp
parent009fe0755e47ef824aa4066d51db75aa9021399b (diff)
downloadllvm-f1255186c7c4a631c051e05ed12ea79ed091141d.zip
llvm-f1255186c7c4a631c051e05ed12ea79ed091141d.tar.gz
llvm-f1255186c7c4a631c051e05ed12ea79ed091141d.tar.bz2
[NFC][Alignment] Remove max functions between Align and MaybeAlign
`llvm::max(Align, MaybeAlign)` and `llvm::max(MaybeAlign, Align)` are not used often enough to be required. They also make the code more opaque. Differential Revision: https://reviews.llvm.org/D128121
Diffstat (limited to 'llvm/lib/LTO/LTO.cpp')
-rw-r--r--llvm/lib/LTO/LTO.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 69188a4..2cb832f 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -819,9 +819,10 @@ LTO::addRegularLTO(BitcodeModule BM, ArrayRef<InputFile::Symbol> Syms,
// For now they aren't reported correctly by ModuleSymbolTable.
auto &CommonRes = RegularLTO.Commons[std::string(Sym.getIRName())];
CommonRes.Size = std::max(CommonRes.Size, Sym.getCommonSize());
- MaybeAlign SymAlign(Sym.getCommonAlignment());
- if (SymAlign)
- CommonRes.Align = max(*SymAlign, CommonRes.Align);
+ if (uint32_t SymAlignValue = Sym.getCommonAlignment()) {
+ const Align SymAlign(SymAlignValue);
+ CommonRes.Align = std::max(SymAlign, CommonRes.Align.valueOrOne());
+ }
CommonRes.Prevailing |= Res.Prevailing;
}
}