[PATCH] D104679: [LoopUnrolling] Add flag to restrict the unroll with large loop size

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 22 02:33:04 PDT 2021


lebedev.ri added a comment.

I'm still not fine with this approach:

1. `1000` is way too low here. E.g. for znver3 the ideal loop size after unroll is `4096`, which means that even partial unroll will blow past this threshold.
2. The threshold will depend on the underlying libc, since the default stack size differs between them.
3. `for testing purposes` implies this never happens in real world, while the very existence of the patch implies that it does..

It would be really best to deal with the actual stack overflows.



================
Comment at: llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp:1129
+  if (LoopSize > UnrollFullSizeThreshold) {
+    LLVM_DEBUG(dbgs() << "  Not unrolling loop with as large loop size.\n");
+    return LoopUnrollResult::Unmodified;
----------------



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104679/new/

https://reviews.llvm.org/D104679



More information about the llvm-commits mailing list