This is an archive of the discontinued LLVM Phabricator instance.

[asan] Avoid two compiler-synthesized calls to memset & memcpy
ClosedPublic

Authored by rnk on Jun 20 2019, 3:11 PM.

Event Timeline

rnk created this revision.Jun 20 2019, 3:11 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 20 2019, 3:11 PM
Herald added subscribers: Restricted Project, fedor.sergeev, kubamracek. · View Herald Transcript
vitalybuka accepted this revision.Jun 20 2019, 3:32 PM
vitalybuka added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cc
39

How does this help to avoid memset?

This revision is now accepted and ready to land.Jun 20 2019, 3:32 PM
rnk marked an inline comment as done.Jun 21 2019, 9:03 AM
rnk added inline comments.
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_win.cc
39

Actually, I think the boolean is unnecessary. The constructor has to be user-provided. If it's compiler-synthesized, then the compiler zeros out the memory before calling the constructor, as in this code:

struct Foo {
  Foo()
#ifdef USER_CTOR
  {}
#else
  = default;
#endif
  int x = 0;
};
Foo *getit() { return new Foo(); }

I'll simplify it.

This revision was automatically updated to reflect the committed changes.