[LLVMdev] RE : How to eliminate PHI nodes on pointer types?

Rinaldini Julien julien.rinaldini at heig-vd.ch
Tue Aug 21 02:34:30 PDT 2012


Hi!

I'm not sure if I understand well your problem, but you are trying to get rid of the phi node right?
If so, you can use the -reg2mem pass, wich eliminates all phinode, but introduce sometimes others stuffs (like 'critical egdes').

I think I'm trying to do the same: eliminate all phinode from the code, using pointer to get rid of the dominance problem...
I'm trying with DemotePHIToStack() (you can find it in Utils/DemoteRegToStack.cpp), but it doesn't work for what I want.
Maybe it will help you...

Cheers
________________________________________
De : llvmdev-bounces at cs.uiuc.edu [llvmdev-bounces at cs.uiuc.edu] de la part de Andrew Clinton [andrew at sidefx.com]
Date d'envoi : lundi 20 août 2012 22:39
À : Duncan Sands
Cc: llvmdev at cs.uiuc.edu
Objet : Re: [LLVMdev] How to eliminate PHI nodes on pointer types?

On 08/20/2012 03:46 PM, Duncan Sands wrote:
> Hi Andrew,
>
>> Somewhere during optimization PHI nodes on pointer types (including
>> alloca instructions) are being introduced, and they persist through the
>> scalar replacement of aggregates pass and others.  I can't seem to find
>> a combination of passes or transformations to get rid of them.  Has
>> anyone had this problem before, and know a transformation to eliminate
>> it?  My optimization passes rely on everything being in pure SSA form.
> why is this a problem?  Presumably you are happy with phi nodes of integer
> or float type, why are phi nodes of pointer type problematic?
>
> Ciao, Duncan.
>
> PS: I'm not sure what you mean by "pure SSA form".  Phi nodes are needed for
> values of pointer type exactly because these values are in SSA form...

By "pure" I mean that the IR has no alloca instructions, ie. it all has
been promoted to registers.  It's easy to see that this is possible in
the program I posted (by changing the PHI to one on loaded values rather
than pointers).  The presence of allocas is problematic since the
analysis and lowering passes in my optimizer don't handle them.

Andrew
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list