aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2016-07-21 01:07:13 +0000
committerAdam Nemet <anemet@apple.com>2016-07-21 01:07:13 +0000
commit7cfd5971ab09bde7ec4f14e1f995414380ea4179 (patch)
tree5e54e45c8fee1fdf4e88499f095e254715bb8de7 /llvm/lib
parentca8210a952f6f072292cb0d0f196b7e69f4914f3 (diff)
downloadllvm-7cfd5971ab09bde7ec4f14e1f995414380ea4179.zip
llvm-7cfd5971ab09bde7ec4f14e1f995414380ea4179.tar.gz
llvm-7cfd5971ab09bde7ec4f14e1f995414380ea4179.tar.bz2
[OptDiag,LV] Add hotness attribute to applied-optimization remarks
Test coverage is provided by modifying the function in the FP-math testcase that we are allowed to vectorize. llvm-svn: 276223
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp15
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp14
2 files changed, 22 insertions, 7 deletions
diff --git a/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp b/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp
index cae2253..e658755 100644
--- a/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp
+++ b/llvm/lib/Analysis/OptimizationDiagnosticInfo.cpp
@@ -27,6 +27,21 @@ Optional<uint64_t> OptimizationRemarkEmitter::computeHotness(const Value *V) {
return BFI->getBlockProfileCount(cast<BasicBlock>(V));
}
+void OptimizationRemarkEmitter::emitOptimizationRemark(const char *PassName,
+ const DebugLoc &DLoc,
+ const Value *V,
+ const Twine &Msg) {
+ LLVMContext &Ctx = F->getContext();
+ Ctx.diagnose(DiagnosticInfoOptimizationRemark(PassName, *F, DLoc, Msg,
+ computeHotness(V)));
+}
+
+void OptimizationRemarkEmitter::emitOptimizationRemark(const char *PassName,
+ Loop *L,
+ const Twine &Msg) {
+ emitOptimizationRemark(PassName, L->getStartLoc(), L->getHeader(), Msg);
+}
+
void OptimizationRemarkEmitter::emitOptimizationRemarkMissed(
const char *PassName, const DebugLoc &DLoc, const Value *V,
const Twine &Msg) {
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 5befef9..b6ba079 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6575,9 +6575,9 @@ bool LoopVectorizePass::processLoop(Loop *L) {
InnerLoopUnroller Unroller(L, PSE, LI, DT, TLI, TTI, AC, ORE, IC);
Unroller.vectorize(&LVL, CM.MinBWs, CM.VecValuesToIgnore);
- emitOptimizationRemark(F->getContext(), LV_NAME, *F, L->getStartLoc(),
- Twine("interleaved loop (interleaved count: ") +
- Twine(IC) + ")");
+ ORE->emitOptimizationRemark(LV_NAME, L,
+ Twine("interleaved loop (interleaved count: ") +
+ Twine(IC) + ")");
} else {
// If we decided that it is *legal* to vectorize the loop, then do it.
InnerLoopVectorizer LB(L, PSE, LI, DT, TLI, TTI, AC, ORE, VF.Width, IC);
@@ -6591,10 +6591,10 @@ bool LoopVectorizePass::processLoop(Loop *L) {
AddRuntimeUnrollDisableMetaData(L);
// Report the vectorization decision.
- emitOptimizationRemark(F->getContext(), LV_NAME, *F, L->getStartLoc(),
- Twine("vectorized loop (vectorization width: ") +
- Twine(VF.Width) + ", interleaved count: " +
- Twine(IC) + ")");
+ ORE->emitOptimizationRemark(
+ LV_NAME, L, Twine("vectorized loop (vectorization width: ") +
+ Twine(VF.Width) + ", interleaved count: " + Twine(IC) +
+ ")");
}
// Mark the loop as already vectorized to avoid vectorizing again.