Ruiling Song
2014-Jun-18 03:08 UTC
[LLVMdev] Does phi Node always contain an incoming value for its predecessors?
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>
Tim Northover
2014-Jun-24 20:05 UTC
[LLVMdev] Does phi Node always contain an incoming value for its predecessors?
Hi Ruiling, On 18 June 2014 04:08, Ruiling Song <ruiling.song83 at gmail.com> wrote:> 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?Yep, I believe that's correct: blocks in PHI nodes refer to the immediate predecessors rather than any more distant source for a value. Cheers. Tim.