[llvm-commits] SSI patch

Andre Tavares andrelct at dcc.ufmg.br
Fri Jun 26 06:39:35 PDT 2009


Hello Owen,

Owen Anderson wrote:
> On Jun 25, 2009, at 11:01 AM, Nick Lewycky wrote:
>   
>>   // TODO: We do modify the programs code, but we do not know which
>>   // Passes we break.
>>   void SSI::getAnalysisUsage(AnalysisUsage &AU) const {
>>     AU.addRequired<DominanceFrontier> ();
>>     AU.addRequired<DominatorTree> ();
>>     AU.setPreservesAll();
>>   }
>>     
>
> Actually, since he doesn't do anything in his runOnFunction(), he  
> does, in fact, preserves all passes.  It's the client transformation's  
> responsibility to maintain other analyses.  This might also be an  
> argument in favor of making this a utility function under lib/ 
> Transforms/Utils rather than a separate pass.
>
> Also, he needs to addRequiredTransitively() his dependencies, rather  
> than addRequired().  The former guarantees that they will be around  
> until his pass is destructed, while the latter only guarantees their  
> existence until the end of runOnFunction().
>
>   
I said this on my last email to Nick, and I think we should make this 
pass a utility function as you mentioned above.

>>   /// Test if the BasicBlock BB dominates any use or definition of  
>> value.
>>   ///
>>   bool SSI::dominateAny(BasicBlock * BB, Instruction * value) {
>>     Value::use_iterator begin = value->use_begin();
>>     Value::use_iterator end = value->use_end();
>>     for (; begin != end; ++begin) {
>>       Instruction * I = dyn_cast<Instruction> (*begin);
>>     
>
> This function can be much simpler.  The only use of an instruction  
> that isn't dominated by the def is a phi-use.  So you really only need  
> to check the def itself, and any uses that are also phis.
>   
Owen, in this function I'm checking if the phis and sigmas inserted by 
my pass dominate any use of the variable it represents. If it does not 
dominate any there is no need to insert that phi or sigma. How can I 
make this method simpler?

> --Owen
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>   
Thanks for your advices.

-- 
Andre Tavares
Master Student in Computer Science - UFMG - Brasil
http://dcc.ufmg.br/~andrelct




More information about the llvm-commits mailing list