This is an archive of the discontinued LLVM Phabricator instance.

[HWLoops] Stop converting to a while loop when it would be unsafe to
ClosedPublic

Authored by samtebbs on Jul 16 2020, 8:08 AM.

Details

Summary

There are cases where a do-while loop would be converted to a while loop before finding out that it would be unsafe to expand the SCEV in this situation and then bailing out of hardware loop conversion.

This patch checks if it would be unsafe to expand the SCEV and if so stops converting the do-while into a while, allowing conversion to a hardware loop.

Diff Detail

Event Timeline

samtebbs created this revision.Jul 16 2020, 8:08 AM
samtebbs updated this revision to Diff 278486.Jul 16 2020, 8:14 AM

Add context to diff

samparker accepted this revision.Jul 17 2020, 1:12 AM

Nice and tidy fix, thanks!

llvm/lib/CodeGen/HardwareLoops.cpp
406

nit: I think we're supposed to just use auto when it's obvious what the type is, say when using a cast.

411

nit: you don't need curly brackets for one liners.

This revision is now accepted and ready to land.Jul 17 2020, 1:12 AM
samtebbs updated this revision to Diff 278690.Jul 17 2020, 2:44 AM
samtebbs marked 2 inline comments as done.

Fix formatting

Nice and tidy fix, thanks!

Thank you!

samtebbs updated this revision to Diff 278694.Jul 17 2020, 2:56 AM

Update tail predication option in test

This revision was automatically updated to reflect the committed changes.