[llvm-commits] [llvm] r64588 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
Duncan Sands
baldrick at free.fr
Sun Feb 15 03:54:49 PST 2009
Author: baldrick
Date: Sun Feb 15 05:54:49 2009
New Revision: 64588
URL: http://llvm.org/viewvc/llvm-project?rev=64588&view=rev
Log:
Make this more useful for cleaning up after the
one-definition-rule llvm-gcc changes (coming soon
to a tree near you!).
Modified:
llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=64588&r1=64587&r2=64588&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Sun Feb 15 05:54:49 2009
@@ -2405,26 +2405,16 @@
if (J->hasInternalLinkage())
continue;
- // Be conservative and do not perform the transform if multiple aliases
- // potentially target the aliasee. TODO: Make this more aggressive.
+ // Do not perform the transform if multiple aliases potentially target the
+ // aliasee. This check also ensures that it is safe to replace the section
+ // and other attributes of the aliasee with those of the alias.
if (!hasOneUse)
continue;
- // Do not perform the transform if it would change the visibility.
- if (J->getVisibility() != Target->getVisibility())
- continue;
-
- // Do not perform the transform if it would change the section.
- if (J->hasSection() != Target->hasSection() ||
- (J->hasSection() && J->getSection() != Target->getSection()))
- continue;
-
- // Give the aliasee the name and linkage of the alias.
+ // Give the aliasee the name, linkage and other attributes of the alias.
Target->takeName(J);
Target->setLinkage(J->getLinkage());
-
- // The alignment is the only remaining attribute that may not match.
- Target->setAlignment(std::max(J->getAlignment(), Target->getAlignment()));
+ Target->GlobalValue::copyAttributesFrom(J);
// Delete the alias.
M.getAliasList().erase(J);
More information about the llvm-commits
mailing list