[PATCH] D18158: Adding ability to unroll loops using epilogue remainder.

Evgeny Stupachenko via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 02:19:13 PDT 2016


evstupac added inline comments.

================
Comment at: lib/Transforms/Utils/LoopUnrollRuntime.cpp:549-550
@@ -341,6 +548,4 @@
   Value *TripCount = Expander.expandCodeFor(TripCountSC, TripCountSC->getType(),
                                             PreHeaderBR);
-  Value *BECount = Expander.expandCodeFor(BECountSC, BECountSC->getType(),
-                                          PreHeaderBR);
-
+  Value *BECount = nullptr;
   IRBuilder<> B(PreHeaderBR);
----------------
mzolotukhin wrote:
> evstupac wrote:
> > The other point here is that to expand BECount before actual use we'll need to recompute PreHeaderBR, as it is deleted at line 602.
> This makes sense now, thanks. I still feel uneasy about this function though, it's becoming kind of a spaghetti code. Would it be possible to refactor it a bit to get rid of multiple `if (UseEpilogRemainder)`? I think now the amount of code that is shared between these two cases isn't much bigger than the amount of code that is different. If we shuffle the code around (where possible), and factor out some common blocks to helper functions, we can keep only one `if (UseEpilogRemainder)`, or rather have two specialized functions.
Shared code requires a lot of parameters. That way helper functions will add a lot of unnecessary parameters passing. Not sure this will simplify the code.
The difference between epilog and prolog now refers to another way of prolog implementation. I can make prolog implementation closer to epilog, however this will affect prolog source code.
Say prolog implementation do not create PrologPreHeader explicitly, while epilog do create EpilogPreHeader.



Repository:
  rL LLVM

http://reviews.llvm.org/D18158





More information about the llvm-commits mailing list