[PATCH] D25386: [LVI] Try to document the complexities of context instructions
Anna Thomas via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 13 13:38:06 PDT 2017
anna added inline comments.
================
Comment at: include/llvm/Analysis/LazyValueInfo.h:84
+ /// special intrinsics with related semantics: assume, and guards.
+ /// The optional context instruction provides a means to query these
+ /// facts. We also allow context instructions which are not within the block
----------------
anna wrote:
> reames wrote:
> > sanjoy wrote:
> > > Have you tried restructuring the description this way:
> > >
> > > ```
> > > The LVI query predicates accept a CFG element (Block, Edge) and an optional context instruction. When a context instruction is present ... (semantics of the context instruction). If it isn't present, we pretend the context instruction is the beginning of the block / somewhere "inside" the edge.
> > > ```
> > >
> > Hm, you repharsing of the missing context case is interesting. In particular, we might be able to implement the semantics you suggest and get slightly more precise results than we do today. This *isn't* our semantic today, but it would be a completely reasonable one and I don't think it would break any existing users.
> >
> > We'd have to pick beginning or end consistently. End seems like it's more powerful, what do you think? (i.e. for an invoke's normal edge, we'd want the context to be the first non-phi instruction in the normal block, not the invoke itself.)
> How is the value chosen currently when the context instruction is not specified? Is this correct:
> 1. in the case of single Block -- value of Y depends on all instructions in BB? One of these instructions might as well be the context instruction, but it wasnt specified.
> 2. for Edge (start BB, end BB) -- value of Y depends on instructions from first inst in start BB upto last inst in end BB.
Coming back to this, since it would be better to document this clearly and clarify our assumptions :)
```
I think LVI info is for an entire basic block. Once we have guards and instructions that are not `guaranteedToTransferExecutionToSuccessor` in the block, the info at beginning maybe different from the end. However, this is handled correctly depending on the Context Instruction passed in. If there's no CtxtI instruction, we should conservatively chose the info as that in the beginning of the block in such cases.
```
https://reviews.llvm.org/D25386
More information about the llvm-commits
mailing list