[llvm] [Coroutines] Conditional elide coroutines based on hot/cold information (PR #162276)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 7 05:34:56 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- llvm/include/llvm/IR/DiagnosticInfo.h llvm/lib/IR/DiagnosticInfo.cpp llvm/lib/Transforms/Coroutines/CoroAnnotationElide.cpp llvm/lib/Transforms/IPO/PartialInlining.cpp
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp
index 44574362e..8e6d654f6 100644
--- a/llvm/lib/IR/DiagnosticInfo.cpp
+++ b/llvm/lib/IR/DiagnosticInfo.cpp
@@ -275,7 +275,7 @@ DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key,
DiagnosticInfoOptimizationBase::Argument::Argument(StringRef Key,
BranchProbability P)
-: Key(std::string(Key)) {
+ : Key(std::string(Key)) {
raw_string_ostream OS(Val);
P.print(OS);
}
diff --git a/llvm/lib/Transforms/Coroutines/CoroAnnotationElide.cpp b/llvm/lib/Transforms/Coroutines/CoroAnnotationElide.cpp
index 6cbda6b38..120ffc489 100644
--- a/llvm/lib/Transforms/Coroutines/CoroAnnotationElide.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroAnnotationElide.cpp
@@ -154,8 +154,8 @@ PreservedAnalyses CoroAnnotationElidePass::run(LazyCallGraph::SCC &C,
bool HasAttr = CB->hasFnAttr(llvm::Attribute::CoroElideSafe);
if (IsCallerPresplitCoroutine && HasAttr) {
static BranchProbability MinBranchProbability(
- static_cast<int>(CoroElideBranchRatio * MinBlockCounterExecution),
- MinBlockCounterExecution);
+ static_cast<int>(CoroElideBranchRatio * MinBlockCounterExecution),
+ MinBlockCounterExecution);
auto &BFI = FAM.getResult<BlockFrequencyAnalysis>(*Caller);
@@ -165,11 +165,14 @@ PreservedAnalyses CoroAnnotationElidePass::run(LazyCallGraph::SCC &C,
if (Prob < MinBranchProbability) {
ORE.emit([&]() {
- return OptimizationRemarkMissed(DEBUG_TYPE, "CoroAnnotationElideUnlikely", Caller)
- << "'" << ore::NV("callee", Callee->getName())
- << "' not elided in '" << ore::NV("caller", Caller->getName())
- << "' because of low probability: " << ore::NV("probability", Prob)
- << " (threshold: " << ore::NV("threshold", MinBranchProbability) << ")";
+ return OptimizationRemarkMissed(
+ DEBUG_TYPE, "CoroAnnotationElideUnlikely", Caller)
+ << "'" << ore::NV("callee", Callee->getName())
+ << "' not elided in '"
+ << ore::NV("caller", Caller->getName())
+ << "' because of low probability: "
+ << ore::NV("probability", Prob) << " (threshold: "
+ << ore::NV("threshold", MinBranchProbability) << ")";
});
continue;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/162276
More information about the llvm-commits
mailing list