[PATCH] Bug 20788 - bugpoint does not respect the "Alias must point to a definition"
hfinkel at anl.gov
hfinkel at anl.gov
Wed May 6 08:24:44 PDT 2015
This generally looks good, thanks!; you seem unfamiliar with our general coding conventions, so I've made a number of style comments.
================
Comment at: tools/bugpoint/ExtractFunction.cpp:187
@@ -186,1 +186,3 @@
void llvm::DeleteFunctionBody(Function *F) {
+ // First, check whether a GlobalAlias references this declaration.
+ // GlobalAlias MAY NOT reference declarations.
----------------
declaration -> definition
================
Comment at: tools/bugpoint/ExtractFunction.cpp:189
@@ +188,3 @@
+ // GlobalAlias MAY NOT reference declarations.
+ for(;;) {
+ // 1. Find aliases
----------------
space after for
================
Comment at: tools/bugpoint/ExtractFunction.cpp:193
@@ +192,3 @@
+ Module *M = F->getParent();
+ for(Module::alias_iterator i=M->alias_begin(), E=M->alias_end(); i!=E; ++i)
+ if( i->getAliasee() == F )
----------------
space after for
================
Comment at: tools/bugpoint/ExtractFunction.cpp:193
@@ +192,3 @@
+ Module *M = F->getParent();
+ for(Module::alias_iterator i=M->alias_begin(), E=M->alias_end(); i!=E; ++i)
+ if( i->getAliasee() == F )
----------------
hfinkel wrote:
> space after for
i -> I
================
Comment at: tools/bugpoint/ExtractFunction.cpp:194
@@ +193,3 @@
+ for(Module::alias_iterator i=M->alias_begin(), E=M->alias_end(); i!=E; ++i)
+ if( i->getAliasee() == F )
+ aliases.push_back(&*i);
----------------
space after if, no spaced around expression
(same below)
================
Comment at: tools/bugpoint/ExtractFunction.cpp:199
@@ +198,3 @@
+ // 2. Resolve aliases
+ for(unsigned i=0, N=aliases.size(); i<N; ++i) {
+ aliases[i]->replaceAllUsesWith( aliases[i]->getAliasee() );
----------------
General convention would be to use 'e' instead of 'N' here.
================
Comment at: tools/bugpoint/ExtractFunction.cpp:200
@@ +199,3 @@
+ for(unsigned i=0, N=aliases.size(); i<N; ++i) {
+ aliases[i]->replaceAllUsesWith( aliases[i]->getAliasee() );
+ aliases[i]->eraseFromParent();
----------------
No spaces around parameter expression.
http://reviews.llvm.org/D9529
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list