[llvm] [llvm][misexpect][NFC] Fix Twine usage (PR #136446)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 19 11:41:12 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Paul Kirth (ilovepi)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/136446.diff
3 Files Affected:
- (modified) llvm/include/llvm/IR/DiagnosticInfo.h (+1-1)
- (modified) llvm/lib/IR/DiagnosticInfo.cpp (+1-1)
- (modified) llvm/lib/Transforms/Utils/MisExpect.cpp (+1-2)
``````````diff
diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h
index 8743f8058c382..a1113134f6a34 100644
--- a/llvm/include/llvm/IR/DiagnosticInfo.h
+++ b/llvm/include/llvm/IR/DiagnosticInfo.h
@@ -1090,7 +1090,7 @@ class DiagnosticInfoUnsupported : public DiagnosticInfoWithLocationBase {
/// Diagnostic information for MisExpect analysis.
class DiagnosticInfoMisExpect : public DiagnosticInfoWithLocationBase {
public:
- DiagnosticInfoMisExpect(const Instruction *Inst, Twine &Msg);
+ DiagnosticInfoMisExpect(const Instruction *Inst, const Twine &Msg);
/// \see DiagnosticInfo::print.
void print(DiagnosticPrinter &DP) const override;
diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp
index 0e526ada4b405..4315f63cce4f8 100644
--- a/llvm/lib/IR/DiagnosticInfo.cpp
+++ b/llvm/lib/IR/DiagnosticInfo.cpp
@@ -443,7 +443,7 @@ std::string DiagnosticInfoOptimizationBase::getMsg() const {
}
DiagnosticInfoMisExpect::DiagnosticInfoMisExpect(const Instruction *Inst,
- Twine &Msg)
+ const Twine &Msg)
: DiagnosticInfoWithLocationBase(DK_MisExpect, DS_Warning,
*Inst->getParent()->getParent(),
Inst->getDebugLoc()),
diff --git a/llvm/lib/Transforms/Utils/MisExpect.cpp b/llvm/lib/Transforms/Utils/MisExpect.cpp
index 7074376feed9c..ca7e09da9737b 100644
--- a/llvm/lib/Transforms/Utils/MisExpect.cpp
+++ b/llvm/lib/Transforms/Utils/MisExpect.cpp
@@ -106,10 +106,9 @@ void emitMisexpectDiagnostic(Instruction *I, LLVMContext &Ctx,
"Potential performance regression from use of the llvm.expect intrinsic: "
"Annotation was correct on {0} of profiled executions.",
PerString);
- Twine Msg(PerString);
Instruction *Cond = getInstCondition(I);
if (isMisExpectDiagEnabled(Ctx))
- Ctx.diagnose(DiagnosticInfoMisExpect(Cond, Msg));
+ Ctx.diagnose(DiagnosticInfoMisExpect(Cond, Twine(PerString)));
OptimizationRemarkEmitter ORE(I->getParent()->getParent());
ORE.emit(OptimizationRemark(DEBUG_TYPE, "misexpect", Cond) << RemStr.str());
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/136446
More information about the llvm-commits
mailing list