Page MenuHomePhabricator

[Sink] Allow sinking of invariant loads across critical edges
ClosedPublic

Authored by critson on Oct 4 2022, 1:02 AM.

Details

Diff Detail

Event Timeline

critson created this revision.Oct 4 2022, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2022, 1:02 AM
critson requested review of this revision.Oct 4 2022, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2022, 1:02 AM
foad accepted this revision.Oct 4 2022, 3:16 AM

Makes sense to me.

Could do a similar thing in InstCombine's TryToSinkInstruction.

This revision is now accepted and ready to land.Oct 4 2022, 3:16 AM
nikic added a subscriber: nikic.Oct 4 2022, 5:36 AM

Please add an IR test (in llvm/test/Transforms/Sink/).

arsenm added inline comments.Oct 4 2022, 8:31 AM
llvm/lib/Transforms/Scalar/Sink.cpp
83

Probably should go through the AA query for pointsToConstantMemory instead of directly checking the metadata

arsenm added inline comments.Oct 4 2022, 8:55 AM
llvm/lib/Transforms/Scalar/Sink.cpp
83

I guess that's a bit different since it's on the source operand, so a future possible improvements

critson updated this revision to Diff 465245.Oct 4 2022, 6:06 PM
  • Add test llvm/test/Transforms/Sink/invariant-load.ll
arsenm accepted this revision.Oct 4 2022, 6:29 PM