diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/Local.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/Local.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index 624907a..ddef654 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1423,6 +1423,12 @@ static Align tryEnforceAlignment(Value *V, Align PrefAlign, if (!GO->canIncreaseAlignment()) return CurrentAlign; + if (GO->isThreadLocal()) { + unsigned MaxTLSAlign = GO->getParent()->getMaxTLSAlignment() / CHAR_BIT; + if (MaxTLSAlign && PrefAlign > Align(MaxTLSAlign)) + PrefAlign = Align(MaxTLSAlign); + } + GO->setAlignment(PrefAlign); return PrefAlign; } |