[llvm-commits] [patch] Add unnamed_addr in GlobalOpt
Chris Lattner
clattner at apple.com
Tue Jan 18 00:23:04 PST 2011
On Jan 17, 2011, at 9:11 PM, Rafael Ávila de Espíndola wrote:
> The "unnamed.patch" patch adds code for setting unnamed_addr in GlobalOpt. During a clang build this patch manages to set unnamed_addr 1002 times.
>
> The "mergeall.patch" patch is a hack that adds options for forcing the merge of all constants. With all constants merged, the clang binary is 26681264 bytes. With just the globalopt update it is 26734712 bytes.
A comment:
+ if(!GS.isCompared) {
+ GV->setUnnamedAddr(true);
+ NumUnnamed++;
+ }
Space after the if: also, this shouldn't count the global if the unnamed addr bit is already set, right?
@@ -220,6 +229,7 @@ static bool AnalyzeGlobal(const Value *V, GlobalStatus &GS,
} else if (isa<GetElementPtrInst>(I)) {
if (AnalyzeGlobal(I, GS, PHIUsers)) return true;
} else if (isa<SelectInst>(I)) {
+ GS.isCompared = true;
if (AnalyzeGlobal(I, GS, PHIUsers)) return true;
} else if (const PHINode *PN = dyn_cast<PHINode>(I)) {
// PHI nodes we can check just like select or GEP instructions, but we
This doesn't seem needed, is it?
-Chris
More information about the llvm-commits
mailing list