[llvm] [IR] Preserve !invariant.group in copyMetadataForLoad (PR #200535)
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 2 08:07:33 PDT 2026
jlebar wrote:
I see, your argument is that, when our code uses copyMetadataForLoad and change the pointer being loaded, it changes *all* load/store uses of a particular SSA value to a new SSA value. Therefore it's safe to retain invariant.group on the loads/stores?
I think I agree it's safe if that's the case.
OTOH if that's why it's safe, it seems to me that we should be adding invariant.group in the callees, rather than in copyMetadataForLoad? Like, otherwise it seems like it would be easy for someone to use copyMetadataForLoad in a case where they *don't* maintain the invariant that they're changing all uses of the SSA value to a new SSA value?
(Or we could rename the function into copyMetadataAndInvariantGroupForLoad at least to make it explicit that we're maintaining invariant.group, so that hopefully if someone uses it somewhere they shouldn't we'll notice.)
WDYT? I'm happy to make that change if we are in agreement. And thanks for talking through this with me.
https://github.com/llvm/llvm-project/pull/200535
More information about the llvm-commits
mailing list