[llvm] [PowerPC] Alignment of toc-data symbol should not be increased during optimizations (PR #94593)
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 17 17:35:15 PDT 2024
================
@@ -335,6 +335,15 @@ bool GlobalObject::canIncreaseAlignment() const {
if (isELF && !isDSOLocal())
return false;
+ // GV with toc-data attribute is defined in a TOC entry. To mitigate TOC
+ // overflow, the alignment of such symbol should not be increased. Otherwise,
+ // padding is needed thus more TOC entries are wasted.
+ bool isXCOFF =
+ (!Parent || Triple(Parent->getTargetTriple()).isOSBinFormatXCOFF());
+ if (isXCOFF)
+ if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(this))
+ return !GV->hasAttribute("toc-data");
----------------
efriedma-quic wrote:
```suggestion
if (GV->hasAttribute("toc-data"))
return false;
```
https://github.com/llvm/llvm-project/pull/94593
More information about the llvm-commits
mailing list