[llvm] [ExtendLifetimes] Implement llvm.fake.use to extend variable lifetimes (PR #86149)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 10:41:36 PDT 2024


================
@@ -1843,6 +1880,12 @@ void AsmPrinter::emitFunctionBody() {
         // purely meta information.
         break;
       default:
+        // If this is a reload of a spilled register that only feeds into a
+        // FAKE_USE instruction, meaning the load value has no effect on the
+        // program and has only been kept alive for debugging; since it is
+        // still available on the stack, we can skip the load itself.
+        if (isLoadFeedingIntoFakeUse(MI, TII))
+          break;
----------------
arsenm wrote:

It's pretty inappropriate for an instruction to disappear in the AsmPrinter. Can you handle this optimization the same way we do for kill? 

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


More information about the llvm-commits mailing list