Skip to content

Commit cc473c9

Browse files
committed
Merge from 'main' to 'sycl-web' (354 commits)
CONFLICT (content): Merge conflict in clang/lib/Driver/Types.cpp
2 parents 9faf1ee + b9f3b7f commit cc473c9

File tree

910 files changed

+32085
-10927
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

910 files changed

+32085
-10927
lines changed

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ class MCPlusBuilder {
282282
// Initialize the default annotation allocator with id 0
283283
AnnotationAllocators.emplace(0, AnnotationAllocator());
284284
MaxAllocatorId++;
285+
// Build alias map
286+
initAliases();
285287
}
286288

287289
/// Initialize a new annotation allocator and return its id
@@ -1135,6 +1137,9 @@ class MCPlusBuilder {
11351137
virtual const BitVector &getAliases(MCPhysReg Reg,
11361138
bool OnlySmaller = false) const;
11371139

1140+
/// Initialize aliases tables.
1141+
virtual void initAliases();
1142+
11381143
/// Change \p Regs setting all registers used to pass parameters according
11391144
/// to the host abi. Do nothing if not implemented.
11401145
virtual BitVector getRegsUsedAsParams() const {
@@ -1904,6 +1909,11 @@ class MCPlusBuilder {
19041909
llvm_unreachable("not implemented");
19051910
return BlocksVectorTy();
19061911
}
1912+
1913+
// AliasMap caches a mapping of registers to the set of registers that
1914+
// alias (are sub or superregs of itself, including itself).
1915+
std::vector<BitVector> AliasMap;
1916+
std::vector<BitVector> SmallerAliasMap;
19071917
};
19081918

19091919
MCPlusBuilder *createX86MCPlusBuilder(const MCInstrAnalysis *,

bolt/include/bolt/Passes/Inliner.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,24 @@
1818
namespace llvm {
1919
namespace bolt {
2020

21-
class Inliner : public BinaryFunctionPass {
22-
private:
23-
enum InliningType : char {
24-
INL_NONE = 0, /// Cannot inline
25-
INL_TAILCALL, /// Can inline at tail call site
26-
INL_ANY /// Can inline at any call site
27-
};
21+
enum InliningType : char {
22+
INL_NONE = 0, /// Cannot inline
23+
INL_TAILCALL, /// Can inline at tail call site
24+
INL_ANY /// Can inline at any call site
25+
};
26+
27+
struct InliningInfo {
28+
InliningType Type{INL_NONE};
29+
uint64_t SizeAfterInlining{0};
30+
uint64_t SizeAfterTailCallInlining{0};
2831

29-
struct InliningInfo {
30-
InliningType Type{INL_NONE};
31-
uint64_t SizeAfterInlining{0};
32-
uint64_t SizeAfterTailCallInlining{0};
32+
InliningInfo(InliningType Type = INL_NONE) : Type(Type) {}
33+
};
3334

34-
InliningInfo(InliningType Type = INL_NONE) : Type(Type) {}
35-
};
35+
/// Check if the inliner can handle inlining of \p BF.
36+
InliningInfo getInliningInfo(const BinaryFunction &BF);
3637

38+
class Inliner : public BinaryFunctionPass {
3739
std::unordered_map<const BinaryFunction *, InliningInfo> InliningCandidates;
3840

3941
/// Count total amount of bytes inlined for all instances of Inliner.
@@ -74,9 +76,6 @@ class Inliner : public BinaryFunctionPass {
7476
inlineCall(BinaryBasicBlock &CallerBB, BinaryBasicBlock::iterator CallInst,
7577
const BinaryFunction &Callee);
7678

77-
/// Check if the inliner can handle inlining of \p BF.
78-
InliningInfo getInliningInfo(const BinaryFunction &BF) const;
79-
8079
public:
8180
explicit Inliner(const cl::opt<bool> &PrintPass)
8281
: BinaryFunctionPass(PrintPass) {}

bolt/lib/Core/BinaryFunctionProfile.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,16 @@ namespace opts {
2727

2828
extern cl::OptionCategory BoltOptCategory;
2929

30-
cl::opt<IndirectCallPromotionType>
31-
IndirectCallPromotion("indirect-call-promotion",
32-
cl::init(ICP_NONE),
33-
cl::desc("indirect call promotion"),
34-
cl::values(
35-
clEnumValN(ICP_NONE, "none", "do not perform indirect call promotion"),
36-
clEnumValN(ICP_CALLS, "calls", "perform ICP on indirect calls"),
37-
clEnumValN(ICP_JUMP_TABLES, "jump-tables", "perform ICP on jump tables"),
38-
clEnumValN(ICP_ALL, "all", "perform ICP on calls and jump tables")),
39-
cl::ZeroOrMore,
40-
cl::cat(BoltOptCategory));
30+
cl::opt<IndirectCallPromotionType> ICP(
31+
"indirect-call-promotion", cl::init(ICP_NONE),
32+
cl::desc("indirect call promotion"),
33+
cl::values(
34+
clEnumValN(ICP_NONE, "none", "do not perform indirect call promotion"),
35+
clEnumValN(ICP_CALLS, "calls", "perform ICP on indirect calls"),
36+
clEnumValN(ICP_JUMP_TABLES, "jump-tables",
37+
"perform ICP on jump tables"),
38+
clEnumValN(ICP_ALL, "all", "perform ICP on calls and jump tables")),
39+
cl::ZeroOrMore, cl::cat(BoltOptCategory));
4140

4241
extern cl::opt<JumpTableSupportLevel> JumpTables;
4342

@@ -173,8 +172,7 @@ void BinaryFunction::postProcessProfile() {
173172
}
174173
JT->Count += TotalBranchCount;
175174

176-
if (opts::IndirectCallPromotion < ICP_JUMP_TABLES &&
177-
opts::JumpTables < JTS_AGGRESSIVE)
175+
if (opts::ICP < ICP_JUMP_TABLES && opts::JumpTables < JTS_AGGRESSIVE)
178176
continue;
179177

180178
if (JT->Counts.empty())

bolt/lib/Core/MCPlusBuilder.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -441,17 +441,13 @@ bool MCPlusBuilder::hasUseOfPhysReg(const MCInst &MI, unsigned Reg) const {
441441

442442
const BitVector &MCPlusBuilder::getAliases(MCPhysReg Reg,
443443
bool OnlySmaller) const {
444-
// AliasMap caches a mapping of registers to the set of registers that
445-
// alias (are sub or superregs of itself, including itself).
446-
static std::vector<BitVector> AliasMap;
447-
static std::vector<BitVector> SmallerAliasMap;
448-
449-
if (AliasMap.size() > 0) {
450-
if (OnlySmaller)
451-
return SmallerAliasMap[Reg];
452-
return AliasMap[Reg];
453-
}
444+
if (OnlySmaller)
445+
return SmallerAliasMap[Reg];
446+
return AliasMap[Reg];
447+
}
454448

449+
void MCPlusBuilder::initAliases() {
450+
assert(AliasMap.size() == 0 && SmallerAliasMap.size() == 0);
455451
// Build alias map
456452
for (MCPhysReg I = 0, E = RegInfo->getNumRegs(); I != E; ++I) {
457453
BitVector BV(RegInfo->getNumRegs(), false);
@@ -492,10 +488,6 @@ const BitVector &MCPlusBuilder::getAliases(MCPhysReg Reg,
492488
dbgs() << "\n";
493489
}
494490
});
495-
496-
if (OnlySmaller)
497-
return SmallerAliasMap[Reg];
498-
return AliasMap[Reg];
499491
}
500492

501493
uint8_t MCPlusBuilder::getRegSize(MCPhysReg Reg) const {

0 commit comments

Comments
 (0)