[llvm] 7b28cc0 - AMDGPU: Query MachineModuleInfo from PM instead of MachineFunction (#99679)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 21 21:55:44 PDT 2024
Author: Matt Arsenault
Date: 2024-07-22T08:55:39+04:00
New Revision: 7b28cc0c59d2f8a4427e5f0677ff69c7b319c9bb
URL: https://github.com/llvm/llvm-project/commit/7b28cc0c59d2f8a4427e5f0677ff69c7b319c9bb
DIFF: https://github.com/llvm/llvm-project/commit/7b28cc0c59d2f8a4427e5f0677ff69c7b319c9bb.diff
LOG: AMDGPU: Query MachineModuleInfo from PM instead of MachineFunction (#99679)
Added:
Modified:
llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp b/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp
index 452dac4b00993..bd4203ccd6fe4 100644
--- a/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp
+++ b/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp
@@ -217,7 +217,7 @@ class SIMemOpInfo final {
class SIMemOpAccess final {
private:
- AMDGPUMachineModuleInfo *MMI = nullptr;
+ const AMDGPUMachineModuleInfo *MMI = nullptr;
/// Reports unsupported message \p Msg for \p MI to LLVM context.
void reportUnsupported(const MachineBasicBlock::iterator &MI,
@@ -241,7 +241,7 @@ class SIMemOpAccess final {
public:
/// Construct class to support accessing the machine memory operands
/// of instructions in the machine function \p MF.
- SIMemOpAccess(MachineFunction &MF);
+ SIMemOpAccess(const AMDGPUMachineModuleInfo &MMI);
/// \returns Load info if \p MI is a load operation, "std::nullopt" otherwise.
std::optional<SIMemOpInfo>
@@ -806,9 +806,8 @@ SIAtomicAddrSpace SIMemOpAccess::toSIAtomicAddrSpace(unsigned AS) const {
return SIAtomicAddrSpace::OTHER;
}
-SIMemOpAccess::SIMemOpAccess(MachineFunction &MF) {
- MMI = &MF.getMMI().getObjFileInfo<AMDGPUMachineModuleInfo>();
-}
+SIMemOpAccess::SIMemOpAccess(const AMDGPUMachineModuleInfo &MMI_)
+ : MMI(&MMI_) {}
std::optional<SIMemOpInfo> SIMemOpAccess::constructFromMIWithMMO(
const MachineBasicBlock::iterator &MI) const {
@@ -2802,7 +2801,10 @@ bool SIMemoryLegalizer::expandAtomicCmpxchgOrRmw(const SIMemOpInfo &MOI,
bool SIMemoryLegalizer::runOnMachineFunction(MachineFunction &MF) {
bool Changed = false;
- SIMemOpAccess MOA(MF);
+ const MachineModuleInfo &MMI =
+ getAnalysis<MachineModuleInfoWrapperPass>().getMMI();
+
+ SIMemOpAccess MOA(MMI.getObjFileInfo<AMDGPUMachineModuleInfo>());
CC = SICacheControl::create(MF.getSubtarget<GCNSubtarget>());
for (auto &MBB : MF) {
More information about the llvm-commits
mailing list