Skip to content

Commit 3cf143c

Browse files
committed
clang-format.
1 parent 82b6033 commit 3cf143c

File tree

7 files changed

+55
-44
lines changed

7 files changed

+55
-44
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
@@ -2378,7 +2378,6 @@ class LLVM_ABI TargetInstrInfo : public MCInstrInfo {
23782378
return false;
23792379
}
23802380

2381-
23822381
private:
23832382
mutable std::unique_ptr<MIRFormatter> Formatter;
23842383
unsigned CallFrameSetupOpcode, CallFrameDestroyOpcode;

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 4 additions & 2 deletions
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"
@@ -2004,7 +2004,9 @@ void AsmPrinter::emitFunctionBody() {
20042004
return;
20052005
if (NumCallsInBB < *PrefetchTargetIt)
20062006
return;
2007-
MCSymbol *PrefetchTargetSymbol = OutContext.getOrCreateSymbol(getPrefetchTargetSymbolName(MF->getName(), *MBB.getBBID(), *PrefetchTargetIt));
2007+
MCSymbol *PrefetchTargetSymbol =
2008+
OutContext.getOrCreateSymbol(getPrefetchTargetSymbolName(
2009+
MF->getName(), *MBB.getBBID(), *PrefetchTargetIt));
20082010
// If the function is weak-linkage it may be replaced by a strong version,
20092011
// in which case the prefetch targets should also be replaced.
20102012
OutStreamer->emitSymbolAttribute(

llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,10 @@ Error BasicBlockSectionsProfileReader::ReadV1Profile() {
350350
if (getAsUnsignedInteger(PrefetchTargetStr[2], 10, TargetSubblockIndex))
351351
return createProfileParseError(Twine("unsigned integer expected: '") +
352352
PrefetchTargetStr[2]);
353-
FI->second.PrefetchHints.push_back(
354-
PrefetchHint{SubblockID{*SiteBBID, static_cast<unsigned>(SiteSubblockIndex)},
355-
PrefetchTargetStr[0],
356-
SubblockID{*TargetBBID, static_cast<unsigned>(TargetSubblockIndex)}});
353+
FI->second.PrefetchHints.push_back(PrefetchHint{
354+
SubblockID{*SiteBBID, static_cast<unsigned>(SiteSubblockIndex)},
355+
PrefetchTargetStr[0],
356+
SubblockID{*TargetBBID, static_cast<unsigned>(TargetSubblockIndex)}});
357357
continue;
358358
}
359359
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

@@ -100,16 +102,16 @@ bool InsertCodePrefetch::runOnMachineFunction(MachineFunction &MF) {
100102
SmallVector<PrefetchHint> PrefetchHints =
101103
getAnalysis<BasicBlockSectionsProfileReaderWrapperPass>()
102104
.getPrefetchHintsForFunction(MF.getName());
103-
DenseMap<UniqueBBID, SmallVector<PrefetchHint>>
104-
PrefetchHintsBySiteBBID;
105+
DenseMap<UniqueBBID, SmallVector<PrefetchHint>> PrefetchHintsBySiteBBID;
105106
for (const auto &H : PrefetchHints)
106107
PrefetchHintsBySiteBBID[H.SiteID.BBID].push_back(H);
107-
for (auto &[SiteBBID, H]: PrefetchHintsBySiteBBID) {
108+
for (auto &[SiteBBID, H] : PrefetchHintsBySiteBBID) {
108109
llvm::sort(H, [](const PrefetchHint &H1, const PrefetchHint &H2) {
109110
return H1.SiteID.SubblockIndex < H2.SiteID.SubblockIndex;
110111
});
111112
}
112-
auto PtrTy = PointerType::getUnqual(MF.getFunction().getParent()->getContext());
113+
auto PtrTy =
114+
PointerType::getUnqual(MF.getFunction().getParent()->getContext());
113115
const TargetInstrInfo *TII = MF.getSubtarget().getInstrInfo();
114116
for (auto &BB : MF) {
115117
auto It = PrefetchHintsBySiteBBID.find(*BB.getBBID());
@@ -118,15 +120,21 @@ bool InsertCodePrefetch::runOnMachineFunction(MachineFunction &MF) {
118120
const auto &PrefetchHints = It->second;
119121
unsigned NumCallsInBB = 0;
120122
auto InstrIt = BB.begin();
121-
for(auto HintIt = PrefetchHints.begin() ; HintIt != PrefetchHints.end();) {
123+
for (auto HintIt = PrefetchHints.begin(); HintIt != PrefetchHints.end();) {
122124
auto NextInstrIt = InstrIt == BB.end() ? BB.end() : std::next(InstrIt);
123125
while (NumCallsInBB >= HintIt->SiteID.SubblockIndex) {
124-
auto *GV = MF.getFunction().getParent()->getOrInsertGlobal(getPrefetchTargetSymbolName(HintIt->TargetFunction, HintIt->TargetID.BBID, HintIt->TargetID.SubblockIndex), PtrTy);
126+
auto *GV = MF.getFunction().getParent()->getOrInsertGlobal(
127+
getPrefetchTargetSymbolName(HintIt->TargetFunction,
128+
HintIt->TargetID.BBID,
129+
HintIt->TargetID.SubblockIndex),
130+
PtrTy);
125131
TII->insertCodePrefetchInstr(BB, NextInstrIt, GV);
126132
++HintIt;
127133
}
128-
if (InstrIt == BB.end()) break;
129-
if (InstrIt->isCall()) ++NumCallsInBB;
134+
if (InstrIt == BB.end())
135+
break;
136+
if (InstrIt->isCall())
137+
++NumCallsInBB;
130138
InstrIt = NextInstrIt;
131139
}
132140
}

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)