[llvm] [LLVM] Add HasFakeUses to MachineFunction (PR #110097)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 30 03:02:35 PDT 2024
jayfoad wrote:
> Following the addition of the llvm.fake.use intrinsic and corresponding MIR instruction, two further changes are planned: to add an -fextend-lifetimes flag to Clang that emits these intrinsics, and to have -Og enable this flag by default. Currently, some logic for handling fake uses is gated by the optdebug attribute, which is intended to be switched on by -fextend-lifetimes (and by extension -Og later on). However, the decision was made that a general optdebug attribute should be incompatible with other opt_ attributes (e.g. optsize, optnone), since they all express different intents for how to optimize the program. We would still like to allow -fextend-lifetimes with optsize however (i.e. -Os -fextend-lifetimes should be legal), since it may be a useful configuration and there is no technical reason to not allow it.
>
> This patch resolves this by tracking MachineFunctions that have fake uses, allowing us to run passes that interact with them and skip passes that clash with them.
I've read this description twice and I still don't understand why it needs a MachineFunction flag. What kind of things will be gated on it? Is it just a performance thing, so that you have a fast way to find out whether the function contains any fake uses, or does it carry more semantic information than that?
https://github.com/llvm/llvm-project/pull/110097
More information about the llvm-commits
mailing list