Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions llvm/lib/Target/AMDGPU/AMDGPURewriteAGPRCopyMFMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "llvm/CodeGen/LiveStacks.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/InitializePasses.h"

Expand Down Expand Up @@ -659,7 +660,11 @@ AMDGPURewriteAGPRCopyMFMAPass::run(MachineFunction &MF,
if (!Impl.run(MF))
return PreservedAnalyses::all();
auto PA = getMachineFunctionPassPreservedAnalyses();
PA.preserveSet<CFGAnalyses>();
PA.preserve<LiveStacksAnalysis>();
PA.preserveSet<CFGAnalyses>()
.preserve<LiveStacksAnalysis>()
.preserve<VirtRegMapAnalysis>()
.preserve<SlotIndexesAnalysis>()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess SlotIndex is not directly used here, but invoked inside LiveIntervals?
It doesn't seem good to me to explicitly preserve the analyses that aren't explicitly used in a pass. Rather, the pass manager should have some way to preserve them. In this case LiveIntervals analysis is preserved here. The pass-manager infrastructure should preserve the SlitIndex too. Anyway, it doesn't work that way at the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing that out. I agree the current approach isn’t ideal, but given the limitations of the pass manager right now, I’ll leave it as is.

.preserve<LiveIntervalsAnalysis>()
.preserve<LiveRegMatrixAnalysis>();
return PA;
}