[llvm-dev] Disable memset synthesis

bharathi seshadri via llvm-dev
Wed, 16 Aug 2017 02:38:27 -0000

Our application is 32-bit big-endian ARM and we use -O3 with LTO.

clang optimizes certain initialization of structures to zero with
calls to memset, which are not further lowered to move instructions.
Investigating perf reports, it looks like it may be beneficial to
disable this optimization that introduces a function call to memset in
certain hot paths.

I tried passing -fno-builtin, but that doesn't seem to help my case;
the code doesn't compile with -ffreestanding. Any suggestions on what
I could try to avoid the calls to memset? It is possible to reorganize
the code to avoid this, but I am looking for a more general solution.

I find that GCC has an option -fno-tree-loop-distribute-patterns that
can be used to disable memcpy/memset synthesis. I wonder if there is
something similar in llvm/clang.

Thanks,
Bharathi