diff options
| author | Duncan Sands <baldrick@free.fr> | 2009-02-15 11:54:49 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2009-02-15 11:54:49 +0000 |
| commit | 46196aef827543e0c4ebd1a2e47e31c19094d66f (patch) | |
| tree | 64f08a8011696989990bbf98ba3109b15d4e5055 /llvm/lib/Transforms/IPO/GlobalOpt.cpp | |
| parent | e68b888550c872e9ad25145fa8a0dfecf55fbf0f (diff) | |
| download | bcm5719-llvm-46196aef827543e0c4ebd1a2e47e31c19094d66f.tar.gz bcm5719-llvm-46196aef827543e0c4ebd1a2e47e31c19094d66f.zip | |
Make this more useful for cleaning up after the
one-definition-rule llvm-gcc changes (coming soon
to a tree near you!).
llvm-svn: 64588
Diffstat (limited to 'llvm/lib/Transforms/IPO/GlobalOpt.cpp')
| -rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index 4208e9044e8..b60982919e4 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -2405,26 +2405,16 @@ bool GlobalOpt::ResolveAliases(Module &M) { 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); |

