ScalarEvolution: HowFarToZero was wrongly using signed division
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 16 Nov 2014 07:30:35 +0000 (07:30 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 16 Nov 2014 07:30:35 +0000 (07:30 +0000)
commit0df1d1247614a0f3b94e00ac7e54665af4395620
tree969eeb4dcd85560e3b022bd473693ad0db5f90af
parent5854e9fae8cd340ee6b6f1150809a0fb5908838e
ScalarEvolution: HowFarToZero was wrongly using signed division

HowFarToZero was supposed to use unsigned division in order to calculate
the backedge taken count.  However, SCEVDivision::divide performs signed
division.  Unless I am mistaken, no users of SCEVDivision actually want
signed arithmetic: switch to udiv and urem.

This fixes PR21578.

llvm-svn: 222093
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/trip-count-pow2.ll