[LLVMdev] Does phi Node always contain an incoming value for its predecessors?

Ruiling Song ruiling.song83 at gmail.com
Tue Jun 17 20:08:26 PDT 2014


Hi all,

Is below LLVM IR valid?

bb0:
  br i1 bb1, bb5

bb1:         ;pred = bb0
  br bb2

bb2:          ;pred = bb1, bb4
  %5 = phi float [%1, bb0], [%2, bb4]

....

bb4:
   br bb2

You can see bb1, bb4 are direct predecessor of bb2, but the phi node %5
does not contain an incoming value for bb1. Is this a valid LLVM IR
generated from a C-like language?
That is to say is it true that every phiNode within a basic block should
contain an incoming value for every direct predecessor of the current block?

Thanks!
Ruiling
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140618/8d480408/attachment.html>


More information about the llvm-dev mailing list