kapil anand wrote:> Hi,
>
> I have a question regarding addition of explicit dependencies between
> two things in LLVM IR. Suppose I have following code:
>
> %a = alloca i32
> ......
> store 10, i32* %a
> call foo()
>
> Is there any way of adding an explicit dependence between the call to
> foo and the store? Can I add some dependence to represent that this call
> might access the previous store and any pass should not optimize it away.
No, the call can't access the store because %a hasn't been written any
place that @foo could possibly read it. LLVM proves that %a is an
address that has not escaped and optimizes accordingly. If you want that
to change, you could pass %a to @foo or maybe write %a to a global variable.
Nick