[LLVMdev] Getting rid of phi instructions?

Will Dietz willdtz at gmail.com
Wed Aug 31 09:41:59 PDT 2011


On Wed, Aug 31, 2011 at 4:43 AM, Eli Friedman <eli.friedman at gmail.com> wrote:
> On Wed, Aug 31, 2011 at 2:35 AM, Teemu Rinta-aho
> <teemu.rinta-aho at nomadiclab.com> wrote:
>> On 31.8.2011, at 11.41, Eli Friedman wrote:
>>
>>> Mmm... reg2mem will transform IR with PHI's into IR without them, but
>>> it generates a bunch of alloca's, which I would assume are not cheap
>>> to lower to VHDL.  You might have to write your own pass to get the
>>> precise transformation you're looking for.
>>
>> Right. Thanks. I need to see the reg2mem source code.
>
> lib/Transforms/Scalar/Reg2Mem.cpp in the LLVM source tree.
>
> -Eli
>

For what it's worth, mem2reg will *not* remove all phi's (see note in
top of the file mentioned above).  Something to keep in mind, if you
absolutely need no phi's at all.  Writing the transform to finish the
job is a bit more work, which I believe is why it's not already done
in the existing mem2reg.

Just FYI :)

~Will




More information about the llvm-dev mailing list