Skip to content

[AMDGPU] Shrink a live interval instead of recomputing it. NFCI. #108171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 11, 2024

Conversation

jayfoad
Copy link
Contributor

@jayfoad jayfoad commented Sep 11, 2024

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Sep 11, 2024

@llvm/pr-subscribers-backend-amdgpu

Author: Jay Foad (jayfoad)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/108171.diff

1 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp (+7-7)
diff --git a/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp b/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp
index f9d7ead4ff3ecc..38ebda6cde1e59 100644
--- a/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp
+++ b/llvm/lib/Target/AMDGPU/SIWholeQuadMode.cpp
@@ -1527,13 +1527,18 @@ bool SIWholeQuadMode::lowerCopyInstrs() {
   for (MachineInstr *MI : LowerToCopyInstrs) {
     LLVM_DEBUG(dbgs() << "simplify: " << *MI);
 
-    Register RecomputeReg = 0;
     if (MI->getOpcode() == AMDGPU::V_SET_INACTIVE_B32 ||
         MI->getOpcode() == AMDGPU::V_SET_INACTIVE_B64) {
       assert(MI->getNumExplicitOperands() == 3);
+
+      LiveInterval *RecomputeLI = nullptr;
       if (MI->getOperand(2).isReg())
-        RecomputeReg = MI->getOperand(2).getReg();
+        RecomputeLI = &LIS->getInterval(MI->getOperand(2).getReg());
+
       MI->removeOperand(2);
+
+      if (RecomputeLI)
+        LIS->shrinkToUses(RecomputeLI);
     } else {
       assert(MI->getNumExplicitOperands() == 2);
     }
@@ -1550,11 +1555,6 @@ bool SIWholeQuadMode::lowerCopyInstrs() {
 
     MI->setDesc(TII->get(CopyOp));
     LLVM_DEBUG(dbgs() << " -> " << *MI);
-
-    if (RecomputeReg) {
-      LIS->removeInterval(RecomputeReg);
-      LIS->createAndComputeVirtRegInterval(RecomputeReg);
-    }
   }
   return !LowerToCopyInstrs.empty() || !LowerToMovInstrs.empty();
 }

@jayfoad jayfoad merged commit 01967e2 into llvm:main Sep 11, 2024
10 checks passed
@jayfoad jayfoad deleted the wqm-shrink-li branch September 11, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants