[PATCH] D24790: [LoopUnroll] Use the upper bound of the loop trip count to completely unroll loops

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 10 18:38:50 PDT 2016


mzolotukhin accepted this revision.
mzolotukhin added a comment.
This revision is now accepted and ready to land.

Hi Haicheng,

The patch looks mostly good to me modulo a couple of small remarks, please feel free to commit once they are addressed.

Thanks,
Michael



================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:768-769
+  unsigned ExactTripCount = TripCount;
+  assert(ExactTripCount * MaxTripCount == 0 &&
+         "ExtractTripCound and MaxTripCount cannot both be non zero.");
+  unsigned FullUnrollTripCount = ExactTripCount ? ExactTripCount : MaxTripCount;
----------------
The assert might fail to catch a bug if the multiplication result overflows and wraps around to 0.


================
Comment at: test/Transforms/LoopUnroll/AArch64/full-unroll-trip-count-upper-bound.ll:1-2
+; RUN: opt -loop-unroll -S -mtriple aarch64 -mcpu=cortex-a57 %s | FileCheck %s
+
+; This IR comes from this C code:
----------------
Shouldn't we have `-unroll-upper` here? Actually, I think we need to check that a) a loop is not unrolled without this flag, and b) it's unrolled with it.

Also, what happened to the changes in the other (existing) test?


Repository:
  rL LLVM

https://reviews.llvm.org/D24790





More information about the llvm-commits mailing list