[PATCH] D28593: Update loop branch_weight metadata after loop rotation.

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 13:29:53 PST 2017


trentxintong added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopRotation.cpp:476
+  // data.
+  if (!updateLoopEstimatedBranchWeight(L, GBI, BI /* OrigHeader BR */)) {
+    BI->setMetadata(LLVMContext::MD_prof, nullptr);
----------------
mkuper wrote:
> Also, regardless of the rest of the discussion - I don't think we should drop the metadata on the floor if we fail.
> 
> I don't think "No data is better than imprecise data" is right in the general case, but that's arguable. Specifically here, though, we're imprecise even if updateLoopEstimatedBranchWeight() succeeds, because of the assumptions we make on the distribution.
I am fine changing this, i.e. keeping the metadata when we cant update them properly. I think they would still be useful (not counter-productive) in this case, even though imprecise.


https://reviews.llvm.org/D28593





More information about the llvm-commits mailing list