Skip to content

Commit fc242e3

Browse files
PrasoonMishravikramRH
authored andcommitted
[AMDGPU][NPM] Preserve analyses in AMDGPURewriteAGPRCopyMFMA for NPM (llvm#170130)
The pass preserved LiveStacksAnalysis but failed to preserve LiveIntervalsAnalysis, LiveRegMatrixAnalysis, VirtRegMapAnalysis, and SlotIndexesAnalysis under NPM. This caused these analyses to be invalidated and recomputed, leading to incorrect behavior in subsequent passes like VirtRegRewriter. Fix by explicitly preserving all required analyses in the NPM version, matching the legacy pass manager behavior. --------- Co-authored-by: vikhegde <[email protected]>
1 parent 36dabc9 commit fc242e3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

llvm/lib/Target/AMDGPU/AMDGPURewriteAGPRCopyMFMA.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "llvm/CodeGen/LiveStacks.h"
3333
#include "llvm/CodeGen/MachineFrameInfo.h"
3434
#include "llvm/CodeGen/MachineFunctionPass.h"
35+
#include "llvm/CodeGen/SlotIndexes.h"
3536
#include "llvm/CodeGen/VirtRegMap.h"
3637
#include "llvm/InitializePasses.h"
3738

@@ -659,7 +660,11 @@ AMDGPURewriteAGPRCopyMFMAPass::run(MachineFunction &MF,
659660
if (!Impl.run(MF))
660661
return PreservedAnalyses::all();
661662
auto PA = getMachineFunctionPassPreservedAnalyses();
662-
PA.preserveSet<CFGAnalyses>();
663-
PA.preserve<LiveStacksAnalysis>();
663+
PA.preserveSet<CFGAnalyses>()
664+
.preserve<LiveStacksAnalysis>()
665+
.preserve<VirtRegMapAnalysis>()
666+
.preserve<SlotIndexesAnalysis>()
667+
.preserve<LiveIntervalsAnalysis>()
668+
.preserve<LiveRegMatrixAnalysis>();
664669
return PA;
665670
}

0 commit comments

Comments
 (0)