Skip to content

Commit d4fd382

Browse files
committed
clang format
1 parent dbdc9a4 commit d4fd382

File tree

5 files changed

+46
-52
lines changed

5 files changed

+46
-52
lines changed

llvm/lib/Target/AMDGPU/AMDGPUHotBlockRematerialize.cpp

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#include "AMDGPU.h"
1516
#include "AMDGPUMIRUtils.h"
1617
#include "AMDGPUOccupancyAndLatencyHelper.h"
17-
#include "AMDGPU.h"
18+
#include "GCNRegPressure.h"
19+
#include "SIInstrInfo.h"
20+
#include "SIMachineFunctionInfo.h"
21+
#include "SIRegisterInfo.h"
22+
#include "llvm/ADT/MapVector.h"
1823
#include "llvm/CodeGen/LiveInterval.h"
1924
#include "llvm/CodeGen/LiveIntervals.h"
2025
#include "llvm/CodeGen/MachineDominators.h"
2126
#include "llvm/CodeGen/MachineLoopInfo.h"
2227
#include "llvm/CodeGen/MachinePostDominators.h"
23-
#include "llvm/ADT/MapVector.h"
2428
#include "llvm/CodeGen/SlotIndexes.h"
25-
#include "SIInstrInfo.h"
26-
#include "SIMachineFunctionInfo.h"
27-
#include "SIRegisterInfo.h"
28-
#include "GCNRegPressure.h"
2929

3030
#define DEBUG_TYPE "amdgpu-hot-block-remat"
3131

@@ -111,19 +111,18 @@ class AMDGPUHotBlockRematerialize : public MachineFunctionPass {
111111

112112
bool runOnMachineFunction(MachineFunction &MF) override;
113113

114-
void applyCloneRemat(RematNode &Node,
115-
std::vector<BlockLiveInfo> &HotBlocks,
116-
MachineDominatorTree *DT, MachineRegisterInfo &MRI,
117-
SlotIndexes *SlotIndexes, const SIRegisterInfo *SIRI,
118-
const SIInstrInfo *SIII, MachineFunction &MF);
114+
void applyCloneRemat(RematNode &Node, std::vector<BlockLiveInfo> &HotBlocks,
115+
MachineDominatorTree *DT, MachineRegisterInfo &MRI,
116+
SlotIndexes *SlotIndexes, const SIRegisterInfo *SIRI,
117+
const SIInstrInfo *SIII, MachineFunction &MF);
119118
void applyRemat(MapVector<Register, RematNode> &RematMap,
120-
std::vector<BlockLiveInfo> &HotBlocks, MachineDominatorTree *DT,
121-
llvm::SlotIndexes *SlotIndexes, MachineRegisterInfo &MRI,
122-
const SIRegisterInfo *SIRI, const SIInstrInfo *SIII,
123-
MachineFunction &MF);
119+
std::vector<BlockLiveInfo> &HotBlocks,
120+
MachineDominatorTree *DT, llvm::SlotIndexes *SlotIndexes,
121+
MachineRegisterInfo &MRI, const SIRegisterInfo *SIRI,
122+
const SIInstrInfo *SIII, MachineFunction &MF);
124123
bool hotBlockRemat(MachineFunction &MF, MachineLoopInfo *MLI,
125-
LiveIntervals *LIS, MachineDominatorTree *DT,
126-
MachinePostDominatorTree *PDT, bool &IsNearTarget);
124+
LiveIntervals *LIS, MachineDominatorTree *DT,
125+
MachinePostDominatorTree *PDT, bool &IsNearTarget);
127126

128127
StringRef getPassName() const override { return "AMDGPU rematerialize"; }
129128

@@ -237,11 +236,11 @@ void updateUsers(unsigned Reg, unsigned NewReg, bool IsSubRegDef,
237236
}
238237
}
239238

240-
void AMDGPUHotBlockRematerialize::applyCloneRemat(RematNode &Node,
241-
std::vector<BlockLiveInfo> &HotBlocks,
242-
MachineDominatorTree *DT, MachineRegisterInfo &MRI,
243-
SlotIndexes *SlotIndexes, const SIRegisterInfo *SIRI,
244-
const SIInstrInfo *SIII, MachineFunction &MF) {
239+
void AMDGPUHotBlockRematerialize::applyCloneRemat(
240+
RematNode &Node, std::vector<BlockLiveInfo> &HotBlocks,
241+
MachineDominatorTree *DT, MachineRegisterInfo &MRI,
242+
SlotIndexes *SlotIndexes, const SIRegisterInfo *SIRI,
243+
const SIInstrInfo *SIII, MachineFunction &MF) {
245244
unsigned Reg = Node.Reg;
246245

247246
MachineInstr *DefMI = MRI.getUniqueVRegDef(Reg);
@@ -359,11 +358,11 @@ void applyOneDefOneUseRemat(RematNode &Node, MachineRegisterInfo &MRI,
359358
SlotIndexes->insertMachineInstrInMaps(*DefMI);
360359
}
361360

362-
void AMDGPUHotBlockRematerialize::applyRemat(MapVector<Register, RematNode> &RematMap,
363-
std::vector<BlockLiveInfo> &HotBlocks, MachineDominatorTree *DT,
364-
llvm::SlotIndexes *SlotIndexes, MachineRegisterInfo &MRI,
365-
const SIRegisterInfo *SIRI, const SIInstrInfo *SIII,
366-
MachineFunction &MF) {
361+
void AMDGPUHotBlockRematerialize::applyRemat(
362+
MapVector<Register, RematNode> &RematMap,
363+
std::vector<BlockLiveInfo> &HotBlocks, MachineDominatorTree *DT,
364+
llvm::SlotIndexes *SlotIndexes, MachineRegisterInfo &MRI,
365+
const SIRegisterInfo *SIRI, const SIInstrInfo *SIII, MachineFunction &MF) {
367366
std::vector<RematNode> UpdateList;
368367
for (auto &It : RematMap) {
369368
UpdateList.emplace_back(It.second);
@@ -381,8 +380,7 @@ void AMDGPUHotBlockRematerialize::applyRemat(MapVector<Register, RematNode> &Rem
381380
if (Node.Kind == RematNode::RematKind::OneDefOneUse) {
382381
applyOneDefOneUseRemat(Node, MRI, SlotIndexes, SIRI, SIII);
383382
} else if (Node.Kind == RematNode::RematKind::Clone) {
384-
applyCloneRemat(Node, HotBlocks, DT, MRI, SlotIndexes, SIRI, SIII,
385-
MF);
383+
applyCloneRemat(Node, HotBlocks, DT, MRI, SlotIndexes, SIRI, SIII, MF);
386384
}
387385
}
388386
}
@@ -1234,9 +1232,12 @@ void dumpCandidates(std::vector<RematNode> &RematCandidates, int BlockIndex,
12341232
dbgs() << "Total Size:" << TotalSize << "\n";
12351233
}
12361234

1237-
bool AMDGPUHotBlockRematerialize::hotBlockRemat(MachineFunction &MF, MachineLoopInfo *MLI,
1238-
LiveIntervals *LIS, MachineDominatorTree *DT,
1239-
MachinePostDominatorTree *PDT, bool &IsNearTarget) {
1235+
bool AMDGPUHotBlockRematerialize::hotBlockRemat(MachineFunction &MF,
1236+
MachineLoopInfo *MLI,
1237+
LiveIntervals *LIS,
1238+
MachineDominatorTree *DT,
1239+
MachinePostDominatorTree *PDT,
1240+
bool &IsNearTarget) {
12401241
const GCNSubtarget *ST = &MF.getSubtarget<GCNSubtarget>();
12411242

12421243
const SIInstrInfo *SIII = ST->getInstrInfo();
@@ -1489,8 +1490,7 @@ bool AMDGPUHotBlockRematerialize::hotBlockRemat(MachineFunction &MF, MachineLoop
14891490

14901491
if (!SRematMap.empty()) {
14911492
IsUpdated = true;
1492-
applyRemat(SRematMap, HotBlocks, DT, SlotIndexes, MRI, SIRI, SIII,
1493-
MF);
1493+
applyRemat(SRematMap, HotBlocks, DT, SlotIndexes, MRI, SIRI, SIII, MF);
14941494
LLVM_DEBUG(llvm::dbgs() << "after hotremat"; MF.print(dbgs()););
14951495
}
14961496

@@ -1530,4 +1530,3 @@ char &llvm::AMDGPUHotBlockRematerializeID = AMDGPUHotBlockRematerialize::ID;
15301530
FunctionPass *llvm::createAMDGPUHotBlockRematerializePass() {
15311531
return new AMDGPUHotBlockRematerialize();
15321532
}
1533-

llvm/lib/Target/AMDGPU/AMDGPUMIRUtils.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
//===----------------------------------------------------------------------===//
1414

1515
#include "AMDGPUMIRUtils.h"
16-
#include "SIRegisterInfo.h"
1716
#include "SIInstrInfo.h"
17+
#include "SIRegisterInfo.h"
1818

1919
#include "llvm/CodeGen/LiveInterval.h"
20-
#include "llvm/CodeGen/MachineRegisterInfo.h"
21-
#include "llvm/CodeGen/MachinePostDominators.h"
2220
#include "llvm/CodeGen/MachineLoopInfo.h"
21+
#include "llvm/CodeGen/MachinePostDominators.h"
22+
#include "llvm/CodeGen/MachineRegisterInfo.h"
2323

2424
#define DEBUG_TYPE "xb-mir-util"
2525
using namespace llvm;
@@ -101,11 +101,10 @@ bool loopContainsBoth(const MachineLoopInfo *LI, const MachineBasicBlock *BB1,
101101

102102
} // namespace
103103

104-
105104
namespace llvm {
106105

107106
bool isSccLiveAt(llvm::MachineBasicBlock *MBB,
108-
llvm::MachineBasicBlock::iterator MI) {
107+
llvm::MachineBasicBlock::iterator MI) {
109108
const TargetRegisterInfo *TRI =
110109
MBB->getParent()->getRegInfo().getTargetRegisterInfo();
111110
for (auto It = MI; It != MBB->end(); ++It) {
@@ -205,9 +204,8 @@ MachineBasicBlock::iterator findOrCreateInsertionPointForSccDef(
205204
// TouchedMBBSet is used for scheduling where local live interval could cross
206205
// multiple regions, need to calculate livereg for each region inside touched
207206
// MBB.
208-
bool isLocalLiveInterval(
209-
const LiveInterval &LI, SlotIndexes *Indexes,
210-
SmallDenseSet<MachineBasicBlock *, 2> &TouchedMBBSet) {
207+
bool isLocalLiveInterval(const LiveInterval &LI, SlotIndexes *Indexes,
208+
SmallDenseSet<MachineBasicBlock *, 2> &TouchedMBBSet) {
211209
if (LI.hasSubRanges()) {
212210
for (const auto &S : LI.subranges()) {
213211
if (!isLocalLiveRange(&S, Indexes, TouchedMBBSet))

llvm/lib/Target/AMDGPU/AMDGPUMIRUtils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ bool removeUnusedLanes(llvm::MachineInstr &MI, llvm::MachineRegisterInfo &MRI,
8686
llvm::SlotIndexes *SlotIndexes);
8787

8888
unsigned getRegSize(unsigned Reg, llvm::LaneBitmask &Mask,
89-
const llvm::MachineRegisterInfo &MRI,
90-
const llvm::SIRegisterInfo *SIRI);
89+
const llvm::MachineRegisterInfo &MRI,
90+
const llvm::SIRegisterInfo *SIRI);
9191
void collectLiveSetPressure(const LiveSet &LiveSet,
9292
const llvm::MachineRegisterInfo &MRI,
9393
const llvm::SIRegisterInfo *SIRI,
@@ -97,6 +97,6 @@ bool reach_block(llvm::MachineBasicBlock *FromBB,
9797
llvm::MachineDominatorTree *DT,
9898
llvm::MachinePostDominatorTree *PDT, llvm::MachineLoopInfo *LI,
9999
llvm::MachineBasicBlock *ToBB);
100-
}
100+
} // namespace llvm
101101

102102
#endif

llvm/lib/Target/AMDGPU/AMDGPUOccupancyAndLatencyHelper.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include "GCNSubtarget.h"
1717
#include "SIInstrInfo.h"
1818

19-
#include "llvm/CodeGen/MachineFunction.h"
2019
#include "llvm/CodeGen/MachineBasicBlock.h"
20+
#include "llvm/CodeGen/MachineFunction.h"
2121
#include "llvm/CodeGen/MachineLoopInfo.h"
2222

2323
#include <cmath>
@@ -144,7 +144,6 @@ void AMDGPULatencyTracker::scan(const MachineInstr &MI) {
144144
}
145145
}
146146

147-
148147
SchedScore collectLatency(MachineFunction &MF, const llvm::GCNSubtarget &ST,
149148
const llvm::MachineLoopInfo *MLI) {
150149
SchedScore TotalScore;
@@ -165,5 +164,3 @@ SchedScore collectLatency(MachineFunction &MF, const llvm::GCNSubtarget &ST,
165164
}
166165

167166
} // namespace llvm
168-
169-

llvm/lib/Target/AMDGPU/AMDGPUOccupancyAndLatencyHelper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUOCCUPANCYANDLATENCYHELPER_H
1616
#define LLVM_LIB_TARGET_AMDGPU_AMDGPUOCCUPANCYANDLATENCYHELPER_H
1717

18-
#include "llvm/MC/MCInstrItineraries.h"
1918
#include "llvm/ADT/DenseMap.h"
19+
#include "llvm/MC/MCInstrItineraries.h"
2020

2121
namespace llvm {
2222

@@ -76,5 +76,5 @@ SchedScore collectLatency(llvm::MachineFunction &MF,
7676
const llvm::GCNSubtarget &ST,
7777
const llvm::MachineLoopInfo *MLI = nullptr);
7878

79-
}
79+
} // namespace llvm
8080
#endif

0 commit comments

Comments
 (0)