[PATCH] D25963: [LoopUnroll] Implement profile-based loop peeling

David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 16 21:38:19 PST 2016


davidxl added inline comments.


================
Comment at: lib/Transforms/Utils/LoopUtils.cpp:1089
+  if (!LatchBR->extractProfMetadata(TrueVal, FalseVal))
+    return None;
+
----------------
mkuper wrote:
> danielcdh wrote:
> > mkuper wrote:
> > > Actually, now that I think about this again, I'm not sure this is right.
> > > Dehao, for instrumentation-based profiles, do back-edges of loops that are never taken get any profile metadata? I think they don't, in which case this should probably return 0.
> > I'm not sure about instrumentation-based profiles, but for sample-based profiles, if the backedge is never taken (but executed and thus has sample), it will still get branch probability metadata annotated, which will be (sample_count+1, 1)
> Ok, will keep it as is, then.
as long as the loop body is executed, it will have profile data annotated. If the backedge is never taken, the weight will be (0, 1)


https://reviews.llvm.org/D25963





More information about the llvm-commits mailing list