[llvm] [LLVM] Add new attribute has_fake_use for llvm.fake.use-specific logic (PR #109997)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 08:38:25 PDT 2024


================
@@ -74,9 +74,9 @@ INITIALIZE_PASS_END(RemoveLoadsIntoFakeUses, DEBUG_TYPE,
                     "Remove Loads Into Fake Uses", false, false)
 
 bool RemoveLoadsIntoFakeUses::runOnMachineFunction(MachineFunction &MF) {
-  // Only `optdebug` functions should contain FAKE_USEs, so don't try to run
-  // this for other functions.
-  if (!MF.getFunction().hasFnAttribute(Attribute::OptimizeForDebugging) ||
+  // Only `has_fake_uses` functions should contain FAKE_USEs, so don't try to
+  // run this for other functions.
+  if (!MF.getFunction().hasFnAttribute(Attribute::HasFakeUses) ||
----------------
SLTozer wrote:

It's used for this, and for disabling the post-RA machine scheduler. I do agree that if there's a method that doesn't require adding an attribute, that's preferable, but thought that adding a scan to every function to see if a FAKE_USE exists would be worse. Is there a better way to store this information as part of the MachineFunction itself?

https://github.com/llvm/llvm-project/pull/109997


More information about the llvm-commits mailing list