This is an archive of the discontinued LLVM Phabricator instance.

[MachineSink] Don't break ImplicitNulls
ClosedPublic

Authored by sanjoy on Nov 12 2015, 8:55 PM.

Details

Summary

This teaches MachineSink to not sink instructions that might break the
implicit null check optimization that runs later. This should not
affect frontends that do not use implicit null checks.

Diff Detail

Event Timeline

sanjoy updated this revision to Diff 40107.Nov 12 2015, 8:55 PM
sanjoy retitled this revision from to [MachineSink] Don't break ImplicitNulls.
sanjoy updated this object.
sanjoy added reviewers: aadg, reames.
sanjoy added a subscriber: llvm-commits.

I added a comment to the ImplicitNullChecks pass stating why it is difficult to work with loads sunk below control flow: http://reviews.llvm.org/rL253020

lib/CodeGen/MachineSink.cpp
684

Reading this on phabricator makes me feel that the naming here is not great -- I'll rename this function to SinkingPreventsImplicitNullCheck tomorrow.

sanjoy updated this revision to Diff 40320.Nov 16 2015, 12:30 PM
  • rename helper to SinkingPreventsImplicitNullCheck
majnemer added inline comments.
lib/CodeGen/MachineSink.cpp
694

Can't getBasicBlock fail? IIRC, MachineBasicBlocks aren't obligated to map back to a BasicBlock.

sanjoy added inline comments.Nov 16 2015, 1:05 PM
lib/CodeGen/MachineSink.cpp
694

I think the failure mode is to return nullptr, which should be caught by the check below.

majnemer added inline comments.Nov 16 2015, 1:25 PM
lib/CodeGen/MachineSink.cpp
694

Ah, my eyes didn't see it. Sorry for the noise.

atrick accepted this revision.Jan 19 2016, 3:30 PM
atrick edited edge metadata.

Looks fine to me. At least I don't see any harm in this.

This revision is now accepted and ready to land.Jan 19 2016, 3:30 PM
This revision was automatically updated to reflect the committed changes.