This is an archive of the discontinued LLVM Phabricator instance.

[MachineCopyPropagation] Handle propagation of undef copies
ClosedPublic

Authored by critson on Oct 6 2021, 3:49 AM.

Details

Summary

When propagating undefined copies the undef flag must also be
propagated.

Diff Detail

Event Timeline

critson created this revision.Oct 6 2021, 3:49 AM
critson requested review of this revision.Oct 6 2021, 3:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2021, 3:49 AM
foad added a comment.Oct 6 2021, 3:53 AM

What happens if you don't do this? Does it fail machine verification? I wonder why this bug hasn't come to light earlier?

What happens if you don't do this? Does it fail machine verification? I wonder why this bug hasn't come to light earlier?

Correct, it fails machine verification.
I suspect this is just a case of no one has generated MIR like this before.

foad accepted this revision.Oct 6 2021, 4:01 AM
foad added a reviewer: MatzeB.

LGTM.

llvm/lib/CodeGen/MachineCopyPropagation.cpp
579–580

MOUse.setIsUndef(CopySrc.isUndef()) would be a bit neater, and the same for isRenamable. Dunno if it makes any practical difference.

This revision is now accepted and ready to land.Oct 6 2021, 4:01 AM
critson updated this revision to Diff 377498.Oct 6 2021, 4:06 AM
critson marked an inline comment as done.
  • Address reviewer comments
llvm/lib/CodeGen/MachineCopyPropagation.cpp
579–580

Sure.
Although doing that for isRenamable would definitely change output, so this change is probably not the right place for it.

foad accepted this revision.Oct 6 2021, 4:16 AM