[llvm-commits] [dragonegg] r138035 - /dragonegg/trunk/src/Backend.cpp
Duncan Sands
baldrick at free.fr
Thu Aug 18 22:52:38 PDT 2011
Author: baldrick
Date: Fri Aug 19 00:52:38 2011
New Revision: 138035
URL: http://llvm.org/viewvc/llvm-project?rev=138035&view=rev
Log:
Set unnamed_addr also on globals that are not constant since they
may be proved constant later by the optimizers.
Modified:
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=138035&r1=138034&r2=138035&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Fri Aug 19 00:52:38 2011
@@ -886,13 +886,13 @@
TARGET_ADJUST_LLVM_LINKAGE(GV, decl);
#endif /* TARGET_ADJUST_LLVM_LINKAGE */
- // If this is a constant that never has its address taken then allow it to be
- // merged with other constants (C and C++ say that different variables should
+ // If this is a variable that never has its address taken then allow it to be
+ // merged with other variables (C and C++ say that different variables should
// have different addresses, which is why this is only correct if the address
// is not taken). However if -fmerge-all-constants was specified then allow
- // merging even if the address was taken.
- GV->setUnnamedAddr(GV->isConstant() && (flag_merge_constants >= 2 ||
- !TREE_ADDRESSABLE(decl)));
+ // merging even if the address was taken. Note that merging will only happen
+ // if the global is constant or later proved to be constant by the optimizers.
+ GV->setUnnamedAddr(flag_merge_constants >= 2 || !TREE_ADDRESSABLE(decl));
handleVisibility(decl, GV);
More information about the llvm-commits
mailing list