[PATCH] D86262: [LoopIdiomRecognizePass] Options to disable part or the entire Loop Idiom Recognize Pass

Ettore Tiotto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 07:28:31 PDT 2020


etiotto added a comment.

Here are a couple of programs to test the performance of a simple memset vs a simple initialization loop. On my system (PPC) even this short init. loop is slower than the memset.

  % cat loop.c
  #include <string.h>
  int main() {
    int A[N];
    for (int n=0; n<STEPS; ++n)
      for(int i=0;i<N;++i)
        A[i] = 0;
    return A[0];
  }

% gcc -O0 loop.c -DN=10 -DSTEPS=1000000; time ./a.out
./a.out  0.10s user 0.00s system 99% cpu **0.099** total

  % cat memset.c
  #include <string.h>
  int main() {
    int A[N];
    for (int n=0; n<STEPS; ++n)
      memset(A, 0, N * sizeof(int));
    return A[0];
  }

% gcc -O0 memset.c -DN=10 -DSTEPS=1000000; time ./a.out
./a.out  0.02s user 0.00s system 99% cpu **0.022** total


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86262



More information about the llvm-commits mailing list