This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] memcpy expansion of const volatile struct ignores const zero
ClosedPublic

Authored by simonwallis2 on Sep 4 2020, 3:38 AM.

Details

Summary

In getMemcpyLoadsAndStores(), a memcpy where the source is a zero constant is expanded to a MemOp::Set instead of a MemOp::Copy, even when the memcpy is volatile.
This is incorrect.

The fix is to add a check for volatile, and expand to MemOp::Copy in the volatile case.

Diff Detail

Event Timeline

simonwallis2 created this revision.Sep 4 2020, 3:38 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2020, 3:38 AM
simonwallis2 requested review of this revision.Sep 4 2020, 3:38 AM
chill accepted this revision.Sep 7 2020, 3:34 AM
chill added a subscriber: chill.

LGTM.

This revision is now accepted and ready to land.Sep 7 2020, 3:34 AM