[LLVMdev] Possible Phi Removal Pass?

Eli Friedman eli.friedman at gmail.com
Thu Nov 10 09:26:14 PST 2011


On Thu, Nov 10, 2011 at 9:08 AM,  <bdavis at cs.fsu.edu> wrote:
> Looking through this mailing list's archives, I've found that the most
> common fix attempted for removing phi instructions is to use the
> reg2mem pass. However I'm also finding that this does no guarantee the
> removal of all phi instructions.

Err, I'm pretty sure it does remove all PHI's; not sure where you're
getting the idea that it doesn't.

> I want to write a pass to remove phi instructions without changing
> register/memory usage. Does this sort of translation of phi
> instructions seem reasonable? :

[...]

There is no way to construct LLVM IR like your "Post-pass" example;
LLVM IR is SSA, so every register has precisely one definition.  There
is no way to avoid PHI nodes in the general case except using memory.

-Eli



More information about the llvm-dev mailing list