This is an archive of the discontinued LLVM Phabricator instance.

[MachineLICM] NFC - make safety of moving explicitly for IsLoopInvariantInst
AbandonedPublic

Authored by shchenz on Jun 28 2020, 1:32 AM.

Details

Reviewers
hfinkel
efriedma
arsenm
qcolombet
dmgreen
Group Reviewers
Restricted Project
Summary

Currently, IsLoopInvariantInst returns true implicitly indicate that all the instruction's operands(virtual registers) are not in the same loop with the instruction itself. So it is always safe to move the instruction since all operands are defined outside of loop.

We want to extend the definition of loop invariant instruction. Even operands of instruction A defined in the same loop with A, A may still be a loop invariant instruction, for example, the operands are rematerializable instructions.

This patch makes safety of moving explicitly in IsLoopInvariantInst, so we can extend the definition of loop invariant instruction without considering the above implicitly indicating.

Diff Detail

Event Timeline

shchenz created this revision.Jun 28 2020, 1:32 AM
efriedma added inline comments.Jun 29 2020, 11:40 AM
llvm/lib/CodeGen/MachineLICM.cpp
219

Instead of returning the IsSafeToMove bit, maybe it would be simpler to add an input parameter "AllowRematOperands"?

shchenz marked an inline comment as done.Jun 30 2020, 12:35 AM
shchenz added inline comments.
llvm/lib/CodeGen/MachineLICM.cpp
219

Make sense. Will do this after its child patch D82709's solution is determined.

shchenz abandoned this revision.Jul 7 2020, 5:36 PM

we decide to use another solution in https://reviews.llvm.org/D82709, so this NFC should not need any more.