This is an archive of the discontinued LLVM Phabricator instance.

[IVDescriptors] Support FOR where we have multiple sink pointed
ClosedPublic

Authored by Allen on Jan 30 2022, 2:56 AM.

Details

Summary

Handles the case where Previous doesn't come before LastPrev incorrectly.

Fix https://github.com/llvm/llvm-project/issues/53483

Diff Detail

Event Timeline

Allen created this revision.Jan 30 2022, 2:56 AM
Allen requested review of this revision.Jan 30 2022, 2:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 30 2022, 2:56 AM
Allen updated this revision to Diff 404357.Jan 30 2022, 2:59 AM
Allen edited the summary of this revision. (Show Details)Jan 30 2022, 8:45 PM
Allen added a reviewer: fhahn.
Allen added a subscriber: fhahn.

Thanks for the patch, response inline.

llvm/lib/Analysis/IVDescriptors.cpp
19

I think this handles the case where Previous doesn't come before LastPrev incorrectly. I added an additional test that crashes with the current version of the patch (02ee3fbff816).

To start with, you should be able to use return Previous->comesBefore(LastPrev); here. The reasoning is that if Previous comes before LastPrev, SinkCandidate already gets sunk after Previous, so there's nothing to do here.

I put up a follow-up patch (D118642), that should handle the other case correctly.

Allen marked an inline comment as done.Feb 7 2022, 7:24 PM

@fhahn ping

llvm/lib/Analysis/IVDescriptors.cpp
19

Yes, Thanks a lot for extending.

what need I do next step ? do you mind squash your patch D118642, or just fix the crash of your new added case 02ee3fbff816 ?

fhahn added inline comments.Feb 9 2022, 2:57 AM
llvm/lib/Analysis/IVDescriptors.cpp
19

what need I do next step ? do you mind squash your patch D118642, or just fix the crash of your new added case 02ee3fbff816 ?

As suggested in my comment, you should be able to update the patch to use

return Previous->comesBefore(LastPrev)

instead of

if (Previous->comesBefore(LastPrev))
  return true;

to fix the issue.

Allen updated this revision to Diff 407143.Feb 9 2022, 6:33 AM
Allen marked an inline comment as done.

update to use return Previous->comesBefore(LastPrev); according comment

Allen marked an inline comment as done.Feb 9 2022, 6:43 AM
This comment was removed by Allen.
llvm/lib/Analysis/IVDescriptors.cpp
19

thanks for your comment very much!

Allen edited the summary of this revision. (Show Details)Feb 9 2022, 4:51 PM
fhahn accepted this revision.Feb 10 2022, 12:24 PM

LGTM, thanks with the inline suggestions.

Handles the case where Previous doesn't come before LastPrev incorrectly.

Could you update the commit messages before landing this change? It should definitely handle this correctly rather than incorrectly :)

llvm/lib/Analysis/IVDescriptors.cpp
14

might be more compact to just check LastPrev->getParent() != Previous->getParent().

17

Maybe add a comment along the lines If LastPrev comes after the current Previous, SinkCandidate already gets sunk past Previous and there is nothing to do.

This revision is now accepted and ready to land.Feb 10 2022, 12:24 PM

Oh, and could you double check this version on its own fixes https://github.com/llvm/llvm-project/issues/53483 if you include it in the commit message?

Allen updated this revision to Diff 407735.Feb 10 2022, 5:44 PM
Allen marked an inline comment as done.
Allen marked 2 inline comments as done.Feb 10 2022, 5:49 PM

Oh, and could you double check this version on its own fixes https://github.com/llvm/llvm-project/issues/53483 if you include it in the commit message?

Yes, it still active for this test case.

llvm/lib/Analysis/IVDescriptors.cpp
14

done

17

done, much thanks for detail comment content to add.

fhahn accepted this revision.Feb 11 2022, 1:00 AM

LGTM, thanks!

If you do not yet have commit access, please let me know if you would like me to commit the patch on your behalf. In that case, please provide the name + email to use for the git authorship.

Allen marked 2 inline comments as done.Feb 12 2022, 5:25 PM
Allen added subscribers: Ayal, bhuvanendrakumarn, dmgreen and 6 others.
This comment was removed by Allen.
This revision was landed with ongoing or failed builds.Feb 13 2022, 5:31 PM
This revision was automatically updated to reflect the committed changes.
Allen added a comment.Feb 13 2022, 7:09 PM

If you do not yet have commit access, please let me know if you would like me to commit the patch on your behalf. In that case, please provide the name + email to use for the git authorship.

sorry for late reply, I pushed now as I'm on vacation yesterday.