diff options
author | Eric Christopher <echristo@gmail.com> | 2018-05-27 11:39:34 +0000 |
---|---|---|
committer | Eric Christopher <echristo@gmail.com> | 2018-05-27 11:39:34 +0000 |
commit | 958a1f8d871b08e20b0ba71e5fab24957bba9c86 (patch) | |
tree | e47d940504398418501fcf04ca3465e85011de05 /llvm/lib/Target/TargetLoweringObjectFile.cpp | |
parent | ed169ec42460d8388ad6d10aae49a82154b1f6ea (diff) | |
download | bcm5719-llvm-958a1f8d871b08e20b0ba71e5fab24957bba9c86.tar.gz bcm5719-llvm-958a1f8d871b08e20b0ba71e5fab24957bba9c86.zip |
Remove boolean argument from isSuitableFromBSS.
The argument was used as an additional negative condition and can be
expressed in the if conditional without needing to pass it down.
Update bss commentary around main use.
llvm-svn: 333357
Diffstat (limited to 'llvm/lib/Target/TargetLoweringObjectFile.cpp')
-rw-r--r-- | llvm/lib/Target/TargetLoweringObjectFile.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/Target/TargetLoweringObjectFile.cpp b/llvm/lib/Target/TargetLoweringObjectFile.cpp index ee4cca6ae49..907ecf46e8f 100644 --- a/llvm/lib/Target/TargetLoweringObjectFile.cpp +++ b/llvm/lib/Target/TargetLoweringObjectFile.cpp @@ -64,7 +64,7 @@ static bool isNullOrUndef(const Constant *C) { return true; } -static bool isSuitableForBSS(const GlobalVariable *GV, bool NoZerosInBSS) { +static bool isSuitableForBSS(const GlobalVariable *GV) { const Constant *C = GV->getInitializer(); // Must have zero initializer. @@ -79,10 +79,6 @@ static bool isSuitableForBSS(const GlobalVariable *GV, bool NoZerosInBSS) { if (GV->hasSection()) return false; - // If -nozero-initialized-in-bss is specified, don't ever use BSS. - if (NoZerosInBSS) - return false; - // Otherwise, put it in BSS! return true; } @@ -155,7 +151,7 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalObject *GO, // Handle thread-local data first. if (GVar->isThreadLocal()) { - if (isSuitableForBSS(GVar, TM.Options.NoZerosInBSS)) + if (isSuitableForBSS(GVar) && !TM.Options.NoZerosInBSS) return SectionKind::getThreadBSS(); return SectionKind::getThreadData(); } @@ -164,8 +160,9 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalObject *GO, if (GVar->hasCommonLinkage()) return SectionKind::getCommon(); - // Variable can be easily put to BSS section. - if (isSuitableForBSS(GVar, TM.Options.NoZerosInBSS)) { + // Most non-mergeable zero data can be put in the BSS section unless otherwise + // specified. + if (isSuitableForBSS(GVar) && !TM.Options.NoZerosInBSS) { if (GVar->hasLocalLinkage()) return SectionKind::getBSSLocal(); else if (GVar->hasExternalLinkage()) |