[HWLoops] Stop converting to a while loop when it would be unsafe to
authorSam Tebbs <samuel.tebbs@arm.com>
Thu, 16 Jul 2020 14:55:50 +0000 (15:55 +0100)
committerSam Tebbs <samuel.tebbs@arm.com>
Fri, 17 Jul 2020 10:47:08 +0000 (11:47 +0100)
commit6c348e4067b0826449caef2f77af2fb67c27040a
tree7a20b919c26d59a3371e8ffd598e15129cefa73b
parent760af7a0743278b6dd7782b177f4d6d086c726e0
[HWLoops] Stop converting to a while loop when it would be unsafe to

There were 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.

Differential Revision: https://reviews.llvm.org/D83953
llvm/lib/CodeGen/HardwareLoops.cpp
llvm/test/CodeGen/Thumb2/LowOverheadLoops/exitcount.ll [new file with mode: 0644]