This is an archive of the discontinued LLVM Phabricator instance.

[IndVarSimplify] Don't assert that terminator is not SCEVable (PR55925)
ClosedPublic

Authored by nikic on Jun 8 2022, 3:56 AM.

Details

Summary

The IV widening code currently asserts that terminators aren't SCEVable -- however, this is not the case for invokes with a returned attribute.

As far as I can tell, this assertions is not necessary -- even if we have a critical edge (the second test case), the trunc gets inserted in a legal position. Though I would be happy to instead bail out for the terminator case, as it's something of an edge case, and I don't think the transform is profitable for it anyway.

Fixes https://github.com/llvm/llvm-project/issues/55925.

Diff Detail

Event Timeline

nikic created this revision.Jun 8 2022, 3:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2022, 3:56 AM
nikic requested review of this revision.Jun 8 2022, 3:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 8 2022, 3:56 AM
kyulee added a subscriber: kyulee.Jun 8 2022, 7:08 AM
ellis added a subscriber: ellis.Jun 8 2022, 9:26 AM
fhahn accepted this revision.Jun 8 2022, 11:05 AM

LGTM, thanks! I think the utilities should be able to handle critical edges here now.

This revision is now accepted and ready to land.Jun 8 2022, 11:05 AM
This revision was landed with ongoing or failed builds.Jun 9 2022, 1:12 AM
This revision was automatically updated to reflect the committed changes.
ellis added a comment.Jun 9 2022, 10:21 AM

LGTM, thanks! I think the utilities should be able to handle critical edges here now.

Hi @fhahn. Do you know if there are any recent commits that add the ability to handle this? I'm wondering if this work was recent, or if this commit can be used with an earlier version of LLVM. Thanks!