[PATCH] D55333: VirtRegMap: Preserve LiveDebugVariables
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 5 09:06:41 PST 2018
arsenm created this revision.
arsenm added a reviewer: MatzeB.
Herald added subscribers: nhaehnle, wdng, jvesely, qcolombet.
This avoids recomputing it between regalloc runs.
https://reviews.llvm.org/D55333
Files:
lib/CodeGen/VirtRegMap.cpp
test/CodeGen/AMDGPU/sgpr-regalloc-flags.ll
Index: test/CodeGen/AMDGPU/sgpr-regalloc-flags.ll
===================================================================
--- test/CodeGen/AMDGPU/sgpr-regalloc-flags.ll
+++ test/CodeGen/AMDGPU/sgpr-regalloc-flags.ll
@@ -18,7 +18,6 @@
; DEFAULT: Greedy Register Allocator
; DEFAULT-NEXT: Virtual Register Rewriter
; DEFAULT-NEXT: SI lower SGPR spill instructions
-; DEFAULT-NEXT: Debug Variable Analysis
; DEFAULT-NEXT: Virtual Register Map
; DEFAULT-NEXT: Live Register Matrix
; DEFAULT-NEXT: Machine Optimization Remark Emitter
@@ -42,7 +41,6 @@
; BASIC-DEFAULT-NEXT: Basic Register Allocator
; BASIC-DEFAULT-NEXT: Virtual Register Rewriter
; BASIC-DEFAULT-NEXT: SI lower SGPR spill instructions
-; BASIC-DEFAULT-NEXT: Debug Variable Analysis
; BASIC-DEFAULT-NEXT: Virtual Register Map
; BASIC-DEFAULT-NEXT: Live Register Matrix
; BASIC-DEFAULT-NEXT: Bundle Machine CFG Edges
@@ -58,7 +56,6 @@
; DEFAULT-BASIC: Greedy Register Allocator
; DEFAULT-BASIC-NEXT: Virtual Register Rewriter
; DEFAULT-BASIC-NEXT: SI lower SGPR spill instructions
-; DEFAULT-BASIC-NEXT: Debug Variable Analysis
; DEFAULT-BASIC-NEXT: Virtual Register Map
; DEFAULT-BASIC-NEXT: Live Register Matrix
; DEFAULT-BASIC-NEXT: Basic Register Allocator
@@ -75,7 +72,6 @@
; BASIC-BASIC-NEXT: Basic Register Allocator
; BASIC-BASIC-NEXT: Virtual Register Rewriter
; BASIC-BASIC-NEXT: SI lower SGPR spill instructions
-; BASIC-BASIC-NEXT: Debug Variable Analysis
; BASIC-BASIC-NEXT: Virtual Register Map
; BASIC-BASIC-NEXT: Live Register Matrix
; BASIC-BASIC-NEXT: Basic Register Allocator
Index: lib/CodeGen/VirtRegMap.cpp
===================================================================
--- lib/CodeGen/VirtRegMap.cpp
+++ lib/CodeGen/VirtRegMap.cpp
@@ -182,6 +182,7 @@
SlotIndexes *Indexes;
LiveIntervals *LIS;
VirtRegMap *VRM;
+ LiveDebugVariables *DebugVars;
DenseSet<unsigned> RewriteRegs;
bool ClearVirtRegs;
@@ -239,6 +240,10 @@
AU.addRequired<LiveStacks>();
AU.addPreserved<LiveStacks>();
AU.addRequired<VirtRegMap>();
+
+ if (!ClearVirtRegs)
+ AU.addPreserved<LiveDebugVariables>();
+
MachineFunctionPass::getAnalysisUsage(AU);
}
@@ -250,6 +255,7 @@
Indexes = &getAnalysis<SlotIndexes>();
LIS = &getAnalysis<LiveIntervals>();
VRM = &getAnalysis<VirtRegMap>();
+ DebugVars = getAnalysisIfAvailable<LiveDebugVariables>();
LLVM_DEBUG(dbgs() << "********** REWRITE VIRTUAL REGISTERS **********\n"
<< "********** Function: " << MF->getName() << '\n');
LLVM_DEBUG(VRM->dump());
@@ -263,10 +269,10 @@
// Rewrite virtual registers.
rewrite();
- // Write out new DBG_VALUE instructions.
- getAnalysis<LiveDebugVariables>().emitDebugValues(VRM);
-
if (ClearVirtRegs) {
+ // Write out new DBG_VALUE instructions.
+ DebugVars->emitDebugValues(VRM);
+
// All machine operands and other references to virtual registers have been
// replaced. Remove the virtual registers and release all the transient data.
VRM->clearAllVirt();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55333.176842.patch
Type: text/x-patch
Size: 3019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181205/bc39aec6/attachment.bin>
More information about the llvm-commits
mailing list