This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Prevent InstCombine from triggering an extra iteration if something changed in the initial Worklist creation
ClosedPublic

Authored by craig.topper on Apr 24 2017, 2:01 PM.

Details

Summary

If the Worklist build causes an IR change this change flag currently factors into the flag for running another iteration of the iteration loop. But only changes during processing should trigger another loop.

This patch captures the worklist creation change flag into the outside the loop flag currently used for DbgDeclares and only sends that flag up to the caller. Rerunning the loop only depends on IC.run() now.

This uses the debug output of InstCombine to determine if one or two iterations run. I couldn't think of a better way to detect it since the second spurious iteration shoudn't make any visible changes. Just wasted computation.

I can do a pre-commit of the test case with the CHECK-NOT as a CHECK if this is an ok way to check this.

This is a subset of D31678 as I'm still not sure how to verify the analysis behavior for that.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Apr 24 2017, 2:01 PM
davide accepted this revision.May 12 2017, 12:27 PM

I don't think this makes a big difference, but OK.

This revision is now accepted and ready to land.May 12 2017, 12:27 PM
This revision was automatically updated to reflect the committed changes.