This is an archive of the discontinued LLVM Phabricator instance.

[LICM] Invalidate SCEV upon instruction hoisting
ClosedPublic

Authored by DaniilSuchkov on Oct 24 2019, 2:23 AM.

Details

Summary

Since SCEV can cache information about location of an instruction, it should be invalidated when the instruction is moved.
There should be similar bug in code sinking part of LICM, it will be fixed in a follow-up change.

Diff Detail

Event Timeline

DaniilSuchkov created this revision.Oct 24 2019, 2:23 AM
asbirlea accepted this revision.Oct 24 2019, 12:19 PM

Thank you for the patch! This LGTM as is.

AFAICT, this issue should not occur in sinking, because instructions are not moved there, they are cloned and ScEv will simply not know about the new instructions.

There are a few deletes that may need updating in a follow up, as I'm not sure if the forgetLoop call addresses these.

  • In eraseInstruction.
  • In LoopPromoter.
  • Potential updates in ControlFlowHoister.
This revision is now accepted and ready to land.Oct 24 2019, 12:19 PM

@asbirlea could you please also take a look at the parent revision for this patch that adds the unit test (D69369)?
And if everything looks good, may I ask you to submit both patches? I don't have commit access yet.

This revision was automatically updated to reflect the committed changes.