Skip to content

Commit e9a2af5

Browse files
committed
clang-format.
1 parent ed5d461 commit e9a2af5

File tree

7 files changed

+52
-43
lines changed

7 files changed

+52
-43
lines changed

llvm/include/llvm/CodeGen/InsertCodePrefetch.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111

1212
#include "llvm/ADT/STLExtras.h"
1313
#include "llvm/ADT/SmallString.h"
14-
#include "llvm/Support/UniqueBBID.h"
1514
#include "llvm/Support/CommandLine.h"
15+
#include "llvm/Support/UniqueBBID.h"
1616

1717
namespace llvm {
1818

19-
SmallString<128> getPrefetchTargetSymbolName(StringRef FunctionName, const UniqueBBID &BBID, unsigned SubblockIndex);
19+
SmallString<128> getPrefetchTargetSymbolName(StringRef FunctionName,
20+
const UniqueBBID &BBID,
21+
unsigned SubblockIndex);
2022

2123
} // end namespace llvm
2224

llvm/include/llvm/CodeGen/TargetInstrInfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2389,7 +2389,6 @@ class LLVM_ABI TargetInstrInfo : public MCInstrInfo {
23892389
return false;
23902390
}
23912391

2392-
23932392
private:
23942393
mutable std::unique_ptr<MIRFormatter> Formatter;
23952394
unsigned CallFrameSetupOpcode, CallFrameDestroyOpcode;

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "llvm/BinaryFormat/ELF.h"
4040
#include "llvm/CodeGen/GCMetadata.h"
4141
#include "llvm/CodeGen/GCMetadataPrinter.h"
42+
#include "llvm/CodeGen/InsertCodePrefetch.h"
4243
#include "llvm/CodeGen/LazyMachineBlockFrequencyInfo.h"
4344
#include "llvm/CodeGen/MachineBasicBlock.h"
4445
#include "llvm/CodeGen/MachineBlockHashInfo.h"
@@ -82,7 +83,6 @@
8283
#include "llvm/IR/Instruction.h"
8384
#include "llvm/IR/Instructions.h"
8485
#include "llvm/IR/LLVMRemarkStreamer.h"
85-
#include "llvm/CodeGen/InsertCodePrefetch.h"
8686
#include "llvm/IR/Mangler.h"
8787
#include "llvm/IR/Metadata.h"
8888
#include "llvm/IR/Module.h"

llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,10 @@ Error BasicBlockSectionsProfileReader::ReadV1Profile() {
380380
if (getAsUnsignedInteger(PrefetchTargetStr[2], 10, TargetSubblockIndex))
381381
return createProfileParseError(Twine("unsigned integer expected: '") +
382382
PrefetchTargetStr[2]);
383-
FI->second.PrefetchHints.push_back(
384-
PrefetchHint{SubblockID{*SiteBBID, static_cast<unsigned>(SiteSubblockIndex)},
385-
PrefetchTargetStr[0],
386-
SubblockID{*TargetBBID, static_cast<unsigned>(TargetSubblockIndex)}});
383+
FI->second.PrefetchHints.push_back(PrefetchHint{
384+
SubblockID{*SiteBBID, static_cast<unsigned>(SiteSubblockIndex)},
385+
PrefetchTargetStr[0],
386+
SubblockID{*TargetBBID, static_cast<unsigned>(TargetSubblockIndex)}});
387387
continue;
388388
}
389389
case 't': { // Prefetch target specifier.

llvm/lib/CodeGen/InsertCodePrefetch.cpp

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ using namespace llvm;
3535
#define DEBUG_TYPE "insert-code-prefetch"
3636

3737
namespace llvm {
38-
SmallString<128> getPrefetchTargetSymbolName(StringRef FunctionName, const UniqueBBID &BBID, unsigned SubblockIndex) {
39-
SmallString<128> R("__llvm_prefetch_target_");
40-
R += FunctionName;
41-
R += "_";
42-
R += utostr(BBID.BaseID);
43-
R += "_";
44-
R += utostr(SubblockIndex);
45-
return R;
38+
SmallString<128> getPrefetchTargetSymbolName(StringRef FunctionName,
39+
const UniqueBBID &BBID,
40+
unsigned SubblockIndex) {
41+
SmallString<128> R("__llvm_prefetch_target_");
42+
R += FunctionName;
43+
R += "_";
44+
R += utostr(BBID.BaseID);
45+
R += "_";
46+
R += utostr(SubblockIndex);
47+
return R;
4648
}
4749
} // namespace llvm
4850

@@ -105,16 +107,16 @@ bool InsertCodePrefetch::runOnMachineFunction(MachineFunction &MF) {
105107
SmallVector<PrefetchHint> PrefetchHints =
106108
getAnalysis<BasicBlockSectionsProfileReaderWrapperPass>()
107109
.getPrefetchHintsForFunction(MF.getName());
108-
DenseMap<UniqueBBID, SmallVector<PrefetchHint>>
109-
PrefetchHintsBySiteBBID;
110+
DenseMap<UniqueBBID, SmallVector<PrefetchHint>> PrefetchHintsBySiteBBID;
110111
for (const auto &H : PrefetchHints)
111112
PrefetchHintsBySiteBBID[H.SiteID.BBID].push_back(H);
112-
for (auto &[SiteBBID, H]: PrefetchHintsBySiteBBID) {
113+
for (auto &[SiteBBID, H] : PrefetchHintsBySiteBBID) {
113114
llvm::sort(H, [](const PrefetchHint &H1, const PrefetchHint &H2) {
114115
return H1.SiteID.SubblockIndex < H2.SiteID.SubblockIndex;
115116
});
116117
}
117-
auto PtrTy = PointerType::getUnqual(MF.getFunction().getParent()->getContext());
118+
auto PtrTy =
119+
PointerType::getUnqual(MF.getFunction().getParent()->getContext());
118120
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
119121
for (auto &BB : MF) {
120122
auto It = PrefetchHintsBySiteBBID.find(*BB.getBBID());
@@ -123,15 +125,21 @@ bool InsertCodePrefetch::runOnMachineFunction(MachineFunction &MF) {
123125
const auto &PrefetchHints = It->second;
124126
unsigned NumCallsInBB = 0;
125127
auto InstrIt = BB.begin();
126-
for(auto HintIt = PrefetchHints.begin() ; HintIt != PrefetchHints.end();) {
128+
for (auto HintIt = PrefetchHints.begin(); HintIt != PrefetchHints.end();) {
127129
auto NextInstrIt = InstrIt == BB.end() ? BB.end() : std::next(InstrIt);
128130
while (NumCallsInBB >= HintIt->SiteID.SubblockIndex) {
129-
auto *GV = MF.getFunction().getParent()->getOrInsertGlobal(getPrefetchTargetSymbolName(HintIt->TargetFunction, HintIt->TargetID.BBID, HintIt->TargetID.SubblockIndex), PtrTy);
131+
auto *GV = MF.getFunction().getParent()->getOrInsertGlobal(
132+
getPrefetchTargetSymbolName(HintIt->TargetFunction,
133+
HintIt->TargetID.BBID,
134+
HintIt->TargetID.SubblockIndex),
135+
PtrTy);
130136
TII->insertCodePrefetchInstr(BB, NextInstrIt, GV);
131137
++HintIt;
132138
}
133-
if (InstrIt == BB.end()) break;
134-
if (InstrIt->isCall()) ++NumCallsInBB;
139+
if (InstrIt == BB.end())
140+
break;
141+
if (InstrIt->isCall())
142+
++NumCallsInBB;
135143
InstrIt = NextInstrIt;
136144
}
137145
}

llvm/lib/Target/X86/X86InstrInfo.cpp

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10978,24 +10978,25 @@ void X86InstrInfo::getFrameIndexOperands(SmallVectorImpl<MachineOperand> &Ops,
1097810978
M.getFullAddress(Ops);
1097910979
}
1098010980

10981-
bool X86InstrInfo::insertCodePrefetchInstr(MachineBasicBlock &MBB,
10982-
MachineBasicBlock::iterator InsertBefore,
10983-
const GlobalValue *GV) const {
10981+
bool X86InstrInfo::insertCodePrefetchInstr(
10982+
MachineBasicBlock &MBB, MachineBasicBlock::iterator InsertBefore,
10983+
const GlobalValue *GV) const {
1098410984
MachineFunction &MF = *MBB.getParent();
10985-
MachineInstr *PrefetchInstr = MF.CreateMachineInstr(get(X86::PREFETCHIT1),
10986-
InsertBefore == MBB.instr_end() ? MBB.findPrevDebugLoc(InsertBefore) : InsertBefore->getDebugLoc(),
10987-
true);
10988-
MachineInstrBuilder MIB(MF, PrefetchInstr);
10989-
MIB.addMemOperand(MF.getMachineMemOperand(
10990-
MachinePointerInfo(GV), MachineMemOperand::MOLoad, /*s=*/8,
10991-
/*base_alignment=*/llvm::Align(1)));
10992-
MIB.addReg(X86::RIP).addImm(1).addReg(X86::NoRegister);
10993-
MIB.addGlobalAddress(GV);
10994-
MIB.addReg(X86::NoRegister);
10995-
MBB.insert(InsertBefore, PrefetchInstr);
10996-
return true;
10985+
MachineInstr *PrefetchInstr = MF.CreateMachineInstr(
10986+
get(X86::PREFETCHIT1),
10987+
InsertBefore == MBB.instr_end() ? MBB.findPrevDebugLoc(InsertBefore)
10988+
: InsertBefore->getDebugLoc(),
10989+
true);
10990+
MachineInstrBuilder MIB(MF, PrefetchInstr);
10991+
MIB.addMemOperand(MF.getMachineMemOperand(MachinePointerInfo(GV),
10992+
MachineMemOperand::MOLoad, /*s=*/8,
10993+
/*base_alignment=*/llvm::Align(1)));
10994+
MIB.addReg(X86::RIP).addImm(1).addReg(X86::NoRegister);
10995+
MIB.addGlobalAddress(GV);
10996+
MIB.addReg(X86::NoRegister);
10997+
MBB.insert(InsertBefore, PrefetchInstr);
10998+
return true;
1099710999
}
1099811000

10999-
1100011001
#define GET_INSTRINFO_HELPERS
1100111002
#include "X86GenInstrInfo.inc"

llvm/lib/Target/X86/X86InstrInfo.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,10 +768,9 @@ class X86InstrInfo final : public X86GenInstrInfo {
768768
/// fails to commute the operands, it will return \p Idx1.
769769
unsigned commuteOperandsForFold(MachineInstr &MI, unsigned Idx1) const;
770770

771-
772771
bool insertCodePrefetchInstr(MachineBasicBlock &MBB,
773-
MachineBasicBlock::iterator InsertBefore,
774-
const GlobalValue *GV) const override;
772+
MachineBasicBlock::iterator InsertBefore,
773+
const GlobalValue *GV) const override;
775774
};
776775
} // namespace llvm
777776

0 commit comments

Comments
 (0)