lifetime_start/end

Hello,

What intrinsics “@llvm.lifetime.start/@llvm.lifetime.end” really do? As per my knowledge, they define the live ranges of variables. In the following code section, they seem redundant. However, when I remove them, the behavior of the code becomes non-deterministic. The live ranges of the variables defined by them are never used in the code.

Thanks,

lifetime markers should always be OK to remove, as you noted.

They restrict life ranges and removing them "just" makes the life ranges larger,
regardless if the variables are used or not.

That said, original code or the transformation you apply is probably
the reason for the non-determinism, it's impossible to say from a snipped
like this.

~ Johannes

If removing them, they still must be consistent. That is, for instance, for any execution path that reaches an @llvm.lifetime.end, all must go through a @llvm.lifetime.start (or none of them). I remember problem with loop versioning in Polly, which violated this. StackColoring was not expected to handle inconsistencies.

Michael