This is an archive of the discontinued LLVM Phabricator instance.

[Float2Int] Make sure dependent ranges are calculated first (PR54669)
ClosedPublic

Authored by nikic on Mar 31 2022, 7:28 AM.

Details

Summary

The range calculation in walkForwards() assumes that the ranges of the operands have already been calculated. With the used visit order, this is not necessarily the case when there are multiple roots. (There is nothing guaranteeing that instructions are visited in topological order.)

Fix this by queuing instructions for reprocessing if the operand ranges haven't been calculated yet.

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

Diff Detail

Event Timeline

nikic created this revision.Mar 31 2022, 7:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 7:28 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
nikic requested review of this revision.Mar 31 2022, 7:28 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 7:28 AM

Possible to add a test?

Ooops ... this is supposed to include the test from https://github.com/llvm/llvm-project/issues/54669, but apparently I forgot to git add it.

Nice! I've verified that this solves the problem I saw.
Thanks!

nikic updated this revision to Diff 419701.Apr 1 2022, 3:30 AM

Add test

spatel accepted this revision.Apr 1 2022, 9:03 AM

I haven't looked at this pass very much, but the patch LGTM.

This revision is now accepted and ready to land.Apr 1 2022, 9:03 AM
This revision was landed with ongoing or failed builds.Apr 4 2022, 1:18 AM
This revision was automatically updated to reflect the committed changes.