[LLVMdev] PHINode in entry block

Tim Northover t.p.northover at gmail.com
Tue Jul 15 08:14:39 PDT 2014


Hi,

On 15 July 2014 15:55, William Moses <moses.williamsteven at gmail.com> wrote:
> Consider the case where the entry block to a function acts like a loop (e.g.
> it ends with a conditional break to itself and somewhere else). How would
> one create a PHINode (representing an index perhaps) which has a constant
> index (say 0) when entering the function, and (oldval+1) when looping.

I don't believe you can. The entry block isn't allowed to be part of a
loop, neatly sidestepping the question. Usually people just put an
unconditional branch to the real loop start when it matters.

Cheers.

Tim.



More information about the llvm-dev mailing list