[LLVMdev] Can simplifycfg kill llvm.lifetime intrinsics?

Krzysztof Parzyszek kparzysz at codeaurora.org
Wed Dec 26 14:37:48 PST 2012


On 12/26/2012 3:38 PM, Nick Lewycky wrote:
>
> Of course you can re-start memory that's been ended... if that isn't
> clear in the langref, please fix.

There are several things that aren't clear (at least when I read it).

Case 1:
block:
   %a = phi i32* ..., [ %a.next, %block ]
   llvm.lifetime.begin(4, %a)
   ...
   llvm.lifetime.end(4, %a)  <-- (1)
   %a.next = getelementptr i32* %a, 1
   br %block

Does (1) mean the end of lifetime for the 4 bytes that %a happens to be 
pointing to in the current iteration?  My guess is "yes".


Case 2:
   %a = i32* ...
   llvm.lifetime.begin(4, %a)
   ...
   llvm.lifetime.end(4, %a)  <-- (2)
   %b = load i32 %ptr        <-- (3)

Is (2) a guarantee that *%ptr and *%a are not aliased?
If (2) and (3) were in the opposite order, would it be illegal to move 
(3) past (2)?


-Krzysztof

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
hosted by The Linux Foundation



More information about the llvm-dev mailing list