[PATCH] D23370: [CodeGen] Rename MachineInstr::isInvariantLoad to isDereferenceableInvariantLoad. NFC

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 12:11:21 PDT 2016


hfinkel added a comment.

In https://reviews.llvm.org/D23370#523285, @jlebar wrote:

> > The original text says, "invariant across the function", and it seems important that invariance here is restricted to during the execution of the current function body.
>
>
> If the comment is correct, I agree it's important to keep that part, but I'm not sure it is correct.
>
> The function returns true if, for each load L done by the instruction,
>
> - L is MMO-invariant (meaning here that it is dereferenceable and has the !invariant.load IR annotation -- this patch comes before the one where we split out the notions of MMO-invariance and MMO-dereferenceability), or
> - L loads from a PseudoSourceValue that's constant, or


I think this is the point: These PseudoSourceValues can be things like addresses of things on the caller's stack (or on the stack in general) - they're not constant in some global sense, but they are constant during the execution of the current function. The stack itself is clearly not constant memory.

> - The address L is loading from points to constant memory.

> 

>   I think this means that the load is invariant period, not invariant within the function?





https://reviews.llvm.org/D23370





More information about the llvm-commits mailing list