NFC: clang-format lib/Transforms/Instrumentation/InstrProfiling.cpp

Differential Revision: https://reviews.llvm.org/D114343
This commit is contained in:
Roland McGrath 2021-11-21 18:14:30 -08:00
parent a60b63940a
commit b72b56016a
1 changed files with 21 additions and 20 deletions

View File

@ -64,8 +64,8 @@ cl::opt<bool> DoHashBasedCounterSplit(
cl::desc("Rename counter variable of a comdat function based on cfg hash"), cl::desc("Rename counter variable of a comdat function based on cfg hash"),
cl::init(true)); cl::init(true));
cl::opt<bool> RuntimeCounterRelocation( cl::opt<bool>
"runtime-counter-relocation", RuntimeCounterRelocation("runtime-counter-relocation",
cl::desc("Enable relocating counters at runtime."), cl::desc("Enable relocating counters at runtime."),
cl::init(false)); cl::init(false));
@ -331,7 +331,8 @@ private:
// Check whether the loop satisfies the basic conditions needed to perform // Check whether the loop satisfies the basic conditions needed to perform
// Counter Promotions. // Counter Promotions.
bool isPromotionPossible(Loop *LP, bool
isPromotionPossible(Loop *LP,
const SmallVectorImpl<BasicBlock *> &LoopExitBlocks) { const SmallVectorImpl<BasicBlock *> &LoopExitBlocks) {
// We can't insert into a catchswitch. // We can't insert into a catchswitch.
if (llvm::any_of(LoopExitBlocks, [](BasicBlock *Exit) { if (llvm::any_of(LoopExitBlocks, [](BasicBlock *Exit) {
@ -421,13 +422,13 @@ PreservedAnalyses InstrProfiling::run(Module &M, ModuleAnalysisManager &AM) {
} }
char InstrProfilingLegacyPass::ID = 0; char InstrProfilingLegacyPass::ID = 0;
INITIALIZE_PASS_BEGIN( INITIALIZE_PASS_BEGIN(InstrProfilingLegacyPass, "instrprof",
InstrProfilingLegacyPass, "instrprof", "Frontend instrumentation-based coverage lowering.",
"Frontend instrumentation-based coverage lowering.", false, false) false, false)
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
INITIALIZE_PASS_END( INITIALIZE_PASS_END(InstrProfilingLegacyPass, "instrprof",
InstrProfilingLegacyPass, "instrprof", "Frontend instrumentation-based coverage lowering.", false,
"Frontend instrumentation-based coverage lowering.", false, false) false)
ModulePass * ModulePass *
llvm::createInstrProfilingLegacyPass(const InstrProfOptions &Options, llvm::createInstrProfilingLegacyPass(const InstrProfOptions &Options,
@ -703,14 +704,15 @@ void InstrProfiling::lowerIncrement(InstrProfIncrementInst *Inc) {
LoadInst *LI = dyn_cast<LoadInst>(&I); LoadInst *LI = dyn_cast<LoadInst>(&I);
if (!LI) { if (!LI) {
IRBuilder<> Builder(&I); IRBuilder<> Builder(&I);
GlobalVariable *Bias = M->getGlobalVariable(getInstrProfCounterBiasVarName()); GlobalVariable *Bias =
M->getGlobalVariable(getInstrProfCounterBiasVarName());
if (!Bias) { if (!Bias) {
// Compiler must define this variable when runtime counter relocation // Compiler must define this variable when runtime counter relocation
// is being used. Runtime has a weak external reference that is used // is being used. Runtime has a weak external reference that is used
// to check whether that's the case or not. // to check whether that's the case or not.
Bias = new GlobalVariable(*M, Int64Ty, false, GlobalValue::LinkOnceODRLinkage, Bias = new GlobalVariable(
Constant::getNullValue(Int64Ty), *M, Int64Ty, false, GlobalValue::LinkOnceODRLinkage,
getInstrProfCounterBiasVarName()); Constant::getNullValue(Int64Ty), getInstrProfCounterBiasVarName());
Bias->setVisibility(GlobalVariable::HiddenVisibility); Bias->setVisibility(GlobalVariable::HiddenVisibility);
// A definition that's weak (linkonce_odr) without being in a COMDAT // A definition that's weak (linkonce_odr) without being in a COMDAT
// section wouldn't lead to link errors, but it would lead to a dead // section wouldn't lead to link errors, but it would lead to a dead
@ -839,8 +841,7 @@ static bool needsRuntimeRegistrationOfSectionRange(const Triple &TT) {
return false; return false;
// Use linker script magic to get data/cnts/name start/end. // Use linker script magic to get data/cnts/name start/end.
if (TT.isOSLinux() || TT.isOSFreeBSD() || TT.isOSNetBSD() || if (TT.isOSLinux() || TT.isOSFreeBSD() || TT.isOSNetBSD() ||
TT.isOSSolaris() || TT.isOSFuchsia() || TT.isPS4CPU() || TT.isOSSolaris() || TT.isOSFuchsia() || TT.isPS4CPU() || TT.isOSWindows())
TT.isOSWindows())
return false; return false;
return true; return true;
@ -1078,8 +1079,8 @@ void InstrProfiling::emitNameData() {
} }
auto &Ctx = M->getContext(); auto &Ctx = M->getContext();
auto *NamesVal = ConstantDataArray::getString( auto *NamesVal =
Ctx, StringRef(CompressedNameStr), false); ConstantDataArray::getString(Ctx, StringRef(CompressedNameStr), false);
NamesVar = new GlobalVariable(*M, NamesVal->getType(), true, NamesVar = new GlobalVariable(*M, NamesVal->getType(), true,
GlobalValue::PrivateLinkage, NamesVal, GlobalValue::PrivateLinkage, NamesVal,
getInstrProfNamesVarName()); getInstrProfNamesVarName());