This is an archive of the discontinued LLVM Phabricator instance.

[CGP] don't expand a memcmp with nobuiltin attribute
ClosedPublic

Authored by spatel on Jun 8 2017, 11:35 AM.

Details

Summary

This matches the behavior used in the SDAG when expanding memcmp.

For reference, we're intentionally treating the earlier fortified call transforms differently after:
https://bugs.llvm.org/show_bug.cgi?id=23093
https://reviews.llvm.org/rL233776

One motivation for not transforming nobuiltin calls is that it can interfere with sanitizers:
https://reviews.llvm.org/D19781
https://reviews.llvm.org/D19801

Diff Detail

Event Timeline

spatel created this revision.Jun 8 2017, 11:35 AM
efriedma accepted this revision.Jun 8 2017, 11:40 AM

LGTM with one minor tweak.

include/llvm/Analysis/TargetLibraryInfo.h
246

This should check that CS.getCalledFunction() is nonnull. (CodeGenPrepare::optimizeCallInst checks this explicitly, but other code might not.)

This revision is now accepted and ready to land.Jun 8 2017, 11:40 AM
This revision was automatically updated to reflect the committed changes.