From: Mircea Trofin Date: Thu, 22 Dec 2022 02:36:59 +0000 (-0800) Subject: [NFC] Rename Function::isDebugInfoForProfiling to shouldEmit[...] X-Git-Tag: upstream/17.0.6~22887 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=946831ea2d7717a56383e284426527bc6de3808d;p=platform%2Fupstream%2Fllvm.git [NFC] Rename Function::isDebugInfoForProfiling to shouldEmit[...] The function name was misleading - the expectation set both by the name and by other members of Function (like isDeclaration or isIntrinsic) would be that the function somehow would "be" "debug info for profiling". But that's not the case - the property indicates (as the comment over the declaration also explains) whether debug info should be emitted (for profiling). --- diff --git a/llvm/include/llvm/IR/Function.h b/llvm/include/llvm/IR/Function.h index 5ced53c..0ffbf90 100644 --- a/llvm/include/llvm/IR/Function.h +++ b/llvm/include/llvm/IR/Function.h @@ -917,7 +917,7 @@ public: DISubprogram *getSubprogram() const; /// Returns true if we should emit debug info for profiling. - bool isDebugInfoForProfiling() const; + bool shouldEmitDebugInfoForProfiling() const; /// Check if null pointer dereferencing is considered undefined behavior for /// the function. diff --git a/llvm/lib/CodeGen/MIRFSDiscriminator.cpp b/llvm/lib/CodeGen/MIRFSDiscriminator.cpp index 3152102..ad8a17f 100644 --- a/llvm/lib/CodeGen/MIRFSDiscriminator.cpp +++ b/llvm/lib/CodeGen/MIRFSDiscriminator.cpp @@ -70,7 +70,7 @@ static uint64_t getCallStackHash(const MachineBasicBlock &BB, bool MIRAddFSDiscriminators::runOnMachineFunction(MachineFunction &MF) { if (!EnableFSDiscriminator) return false; - if (!MF.getFunction().isDebugInfoForProfiling()) + if (!MF.getFunction().shouldEmitDebugInfoForProfiling()) return false; bool Changed = false; diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index 532f715..bc1deb0 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -1626,7 +1626,7 @@ DISubprogram *Function::getSubprogram() const { return cast_or_null(getMetadata(LLVMContext::MD_dbg)); } -bool Function::isDebugInfoForProfiling() const { +bool Function::shouldEmitDebugInfoForProfiling() const { if (DISubprogram *SP = getSubprogram()) { if (DICompileUnit *CU = SP->getUnit()) { return CU->getDebugInfoForProfiling(); diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp index 9fe530b..919a752 100644 --- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp @@ -508,7 +508,8 @@ LoopUnrollResult llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI, // When a FSDiscriminator is enabled, we don't need to add the multiply // factors to the discriminators. - if (Header->getParent()->isDebugInfoForProfiling() && !EnableFSDiscriminator) + if (Header->getParent()->shouldEmitDebugInfoForProfiling() && + !EnableFSDiscriminator) for (BasicBlock *BB : L->getBlocks()) for (Instruction &I : *BB) if (!isa(&I)) diff --git a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp index 47d46c4..5cf5d19 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp @@ -348,7 +348,8 @@ llvm::UnrollAndJamLoop(Loop *L, unsigned Count, unsigned TripCount, // When a FSDiscriminator is enabled, we don't need to add the multiply // factors to the discriminators. - if (Header->getParent()->isDebugInfoForProfiling() && !EnableFSDiscriminator) + if (Header->getParent()->shouldEmitDebugInfoForProfiling() && + !EnableFSDiscriminator) for (BasicBlock *BB : L->getBlocks()) for (Instruction &I : *BB) if (!isa(&I)) diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp index 6d77821..a3175a0 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.cpp +++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp @@ -265,7 +265,7 @@ void VPTransformState::setDebugLocFromInst(const Value *V) { const DILocation *DIL = Inst->getDebugLoc(); // When a FSDiscriminator is enabled, we don't need to add the multiply // factors to the discriminators. - if (DIL && Inst->getFunction()->isDebugInfoForProfiling() && + if (DIL && Inst->getFunction()->shouldEmitDebugInfoForProfiling() && !isa(Inst) && !EnableFSDiscriminator) { // FIXME: For scalable vectors, assume vscale=1. auto NewDIL =