[cfe-dev] Disable memset synthesis

bharathi seshadri via cfe-dev cfe-dev at lists.llvm.org
Tue Aug 15 19:38:27 PDT 2017


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



More information about the cfe-dev mailing list