summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2017-06-13 20:44:08 +0000
committerTeresa Johnson <tejohnson@google.com>2017-06-13 20:44:08 +0000
commit8015f885255c85810b7082e0585d40a1460fe35e (patch)
tree9031f74d09779e717419b3f621838108ef0b1ffd /llvm/lib
parent338663348a5ce7d3d72723f35c05dfeb908e95f7 (diff)
downloadbcm5719-llvm-8015f885255c85810b7082e0585d40a1460fe35e.tar.gz
bcm5719-llvm-8015f885255c85810b7082e0585d40a1460fe35e.zip
[PGO] Update VP metadata after memory intrinsic optimization
Summary: Leave an updated VP metadata on the fallback memcpy intrinsic after specialization. This can be used for later possible expansion based on the average of the remaining values. Reviewers: davidxl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D34164 llvm-svn: 305321
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
index 96027bc3d0a..39a3ef2a49a 100644
--- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
+++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp
@@ -884,6 +884,7 @@ bool MemOPSizeOpt::perform(MemIntrinsic *MI) {
// Keeping track of the count of the default case:
uint64_t RemainCount = TotalCount;
+ uint64_t SavedRemainCount = SavedTotalCount;
SmallVector<uint64_t, 16> SizeIds;
SmallVector<uint64_t, 16> CaseCounts;
uint64_t MaxCount = 0;
@@ -912,6 +913,8 @@ bool MemOPSizeOpt::perform(MemIntrinsic *MI) {
assert(RemainCount >= C);
RemainCount -= C;
+ assert(SavedRemainCount >= VD.Count);
+ SavedRemainCount -= VD.Count;
if (++Version > MemOPMaxVersion && MemOPMaxVersion != 0)
break;
@@ -968,6 +971,11 @@ bool MemOPSizeOpt::perform(MemIntrinsic *MI) {
// Clear the value profile data.
MI->setMetadata(LLVMContext::MD_prof, nullptr);
+ // If all promoted, we don't need the MD.prof metadata.
+ if (SavedRemainCount > 0 || Version != NumVals)
+ // Otherwise we need update with the un-promoted records back.
+ annotateValueSite(*Func.getParent(), *MI, VDs.slice(Version),
+ SavedRemainCount, IPVK_MemOPSize, NumVals);
DEBUG(dbgs() << "\n\n== Basic Block After==\n");
OpenPOWER on IntegriCloud