[llvm-commits] Patch to add flag in llvm-extract for including aliases in the extraction.

Jan Sjodin jan_sjodin at yahoo.com
Tue Sep 25 10:48:20 PDT 2012


I tried that, but eraseFromParent makes the alias_iterator fail, since the underlying data structure is modified. 


- Jan



----- Original Message -----
> From: "Villmow, Micah" <Micah.Villmow at amd.com>
> To: Jan Sjodin <jan_sjodin at yahoo.com>; Duncan Sands <baldrick at free.fr>; "llvm-commits at cs.uiuc.edu" <llvm-commits at cs.uiuc.edu>
> Cc: 
> Sent: Tuesday, September 25, 2012 11:34 AM
> Subject: RE: [llvm-commits] Patch to add flag in llvm-extract for including aliases in the extraction.
> 
> So, the patch itself looks fine in its current form, however is there not a way 
> to delete the alias's without requiring to store them first?
> Maybe something like this would work?
> +static void extractAliases(Module* M,
> +                           SetVector<GlobalValue *> &GVs) {+  
> +  // Find aliases to be erased
> +  for (Module::alias_iterator I = M->alias_begin(), E = M->alias_end();
> +       I != E; ) {
> +    GlobalAlias *GA = I++;
> +    GlobalValue *GV =
> +      const_cast<GlobalValue*>((GA).resolveAliasedGlobal(false));
> +    if ((GVs.count(GV) != 0) == DeleteFn)
> +      GA->eraseFromParent();
> +  }
> +}
> 
>>  -----Original Message-----
>>  From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-
>>  bounces at cs.uiuc.edu] On Behalf Of Jan Sjodin
>>  Sent: Tuesday, September 25, 2012 6:23 AM
>>  To: Duncan Sands; llvm-commits at cs.uiuc.edu
>>  Subject: Re: [llvm-commits] Patch to add flag in llvm-extract for
>>  including aliases in the extraction.
>> 
>>  Ok. Re-ping-ping with patch!
>> 
>>  - Jan
>> 
>>  >________________________________
>>  > From: Duncan Sands <baldrick at free.fr>
>>  >To: llvm-commits at cs.uiuc.edu
>>  >Sent: Saturday, September 22, 2012 6:06 AM
>>  >Subject: Re: [llvm-commits] Patch to add flag in llvm-extract for
>>  including aliases in the extraction.
>>  >
>>  >On 21/09/12 17:36, Jan Sjodin wrote:
>>  >>
>>  >> Ping! Ping!
>>  >
>>  >Please supply the patch when you ping.
>>  >
>>  >Ciao, Duncan.
>>  >_______________________________________________
>>  >llvm-commits mailing list
>>  >llvm-commits at cs.uiuc.edu
>>  >http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>  >
>>  >
>>  >
> 




More information about the llvm-commits mailing list