Fix large count and negative constant count handling in PPCCTRLoops
authorHal Finkel <hfinkel@anl.gov>
Mon, 18 Mar 2013 17:40:44 +0000 (17:40 +0000)
committerHal Finkel <hfinkel@anl.gov>
Mon, 18 Mar 2013 17:40:44 +0000 (17:40 +0000)
commit9887ec31e630ede8541dee1d90c44a1efb63c417
treeb9623fac38109581e69406d80e7f4ac4958fb937
parent1448d06156728712f47e5a71fac8e8edc0aba73b
Fix large count and negative constant count handling in PPCCTRLoops

This commit fixes an assert that would occur on loops with large constant counts
(like looping for ((uint32_t) -1) iterations on PPC64). The existing code did
not handle counts that it computed to be negative (asserting instead), but
these can be created with valid inputs.

This bug was discovered by bugpoint while I was attempting to isolate a
completely different problem.

Also, in writing test cases for the negative-count problem, I discovered that
the ori/lsi handling was broken (there was a typo which caused the logic that
was supposed to detect these pairs and extract the iteration count to always
fail). This has now also been corrected (and is covered by one of the new test
cases).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177295 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/PPCCTRLoops.cpp
test/CodeGen/PowerPC/negctr.ll [new file with mode: 0644]