[PATCH] D23388: [LoopUnroll] By default disable unrolling when optimizing for size.

Davide Italiano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 31 12:51:05 PDT 2017


davide added a comment.

I looked at your benchmarks numbers, with particular attention to the worst regressions, and I'm not convinced these benchmarks are representative.
There are a couple of issues:

1. They're lifetime is too short (basically, I wasn't able to find anything which lasted more than 0.05s). This makes pretty much impossible to profile and understand where the cycles are spent reliably.
2. Some of these benchmarks are a little noisy (even after I pinned a thread to a CPU, disable ASLR and frequency scaling etc...)

  [davide at cupiditate C]$ time ~/work/llvm/build-rel-noassert/bin/clang -Os bigstack.c
  
  real    0m0.048s
  user    0m0.035s
  sys     0m0.013s

I think we should try to base our decisions (at least for compile time choices on more real-world/CPU intensive programs/workloads).

Side note: If I take `clang.bc` in an LTO build and run `opt -O2` on it I see:

  10.8451 (  1.8%)   0.2831 (  2.3%)  11.1282 (  1.8%)  11.0717 (  1.8%)  Unroll loops

So we just try to execute loop unroll to realize the unroll threshold is zero and bail it. Turns out this is 2% of the time for large testcases.
If we want to disable loop unroll for `-Os` (I think we shouldn't :) I'd rather disable it entirely instead of adjusting the thresholds to zero.


Repository:
  rL LLVM

https://reviews.llvm.org/D23388





More information about the llvm-commits mailing list