[llvm] Move ExpandMemCmp and MergeIcmp to the middle end (PR #77370)

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 23:47:47 PST 2024


legrosbuffle wrote:

> I don't really know what the issue was, exactly. The review doesn't say, and I don't have any further information.

I think I remember that one of these issues was that sanitizers would insert instrumentation around calls to `memcmp` and around loads and stores. When building in sanitizer mode, the last pass of the pipeline would insert `nobuiltin` on `memcmp` calls, so that they are not expanded during codegen and the sanitizer runtime can intercept the calls.

When `ExpandMemCmp` is moved higher up in the pipeline,  it turns memcmp into loads and stores, which prevents the sanitizers from understanding that the semantic is memcmp. So the sanitizers sometimes insert a ton of instrumentation for expanded `memcmp` calls, which is both inefficient and prevents the runtime from doing as good a job as when a call is present (arguably this is an issue with the sanitizer itself, but unfortunately this is how things are).

There was also the issue mentionned by +emerson:

> We also detected some compile time regressions in the CTMark subset of the test suite, with lencod regressing by around 4-5%. I haven't fully bisected but the commit list was short and this seemed to be the only suspicious change.

https://github.com/llvm/llvm-project/pull/77370


More information about the llvm-commits mailing list