[LLVMdev] Inferring dependencies in phi instructions

escha escha at apple.com
Mon Jun 29 08:06:20 PDT 2015


> On Jun 29, 2015, at 7:57 AM, Anirudh Sivaraman <sk.anirudh at gmail.com> wrote:
> 
> On Mon, Jun 29, 2015 at 7:23 AM, John Criswell <jtcriswel at gmail.com <mailto:jtcriswel at gmail.com>> wrote:
>> On 6/29/15 5:16 AM, Evgeny Astigeevich wrote:
>>> 
>>> Hi Anirudh,
>>> 
>>> 'x' has a control dependency on 'y' because the value assigned to 'x'
>>> depends on a path selected. This dependency can be converted into a data
>>> dependency by means of a 'select' instruction because the control flow is
>>> simple.
>> 
>> 
>> Just an FYI, there is an optimization called "If-Conversion" which
>> transforms control dependencies to data dependencies; it is discussed in the
>> Allen and Kennedy book ("Optimizing Compilers for Modern Architectures" in
>> Chapter 6 or 7,  I think).
>> 
> 
> I tried this, but how do I express the resulting predicated
> instructions in llvm's IR? For instance,
> 
> X = a + b
> 
> becomes
> 
> X = if (path_condition) (a + b)
> 
> I couldn't find an appropriate instruction type for predicated instructions.

I believe you’re looking for the “select” IR instruction.

—escha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150629/33635db2/attachment.html>


More information about the llvm-dev mailing list