This is an archive of the discontinued LLVM Phabricator instance.

[ScalarEvolution] Fix base condition in isNormalAddRecPHI.
ClosedPublic

Authored by bevinh on Dec 7 2017, 1:44 AM.

Details

Summary

The function is meant to recurse until it comes upon the
phi it's looking for. However, with the current condition,
it will recurse until it finds anything _but_ the phi.

The function will even fail for simple cases like:

%i = phi i32 [ %inc, %loop ], ...
...
%inc = add i32 %i, 1

because the base condition will not happen when the phi
is recursed to, and the recursion will end with a 'false'
result since the previous instruction is a phi.

Diff Detail

Repository
rL LLVM

Event Timeline

bevinh created this revision.Dec 7 2017, 1:44 AM
bjope added a subscriber: bjope.Dec 7 2017, 1:44 AM
bevinh updated this revision to Diff 125912.Dec 7 2017, 2:05 AM

Removed the x86 triple from the test.

Ka-Ka added a subscriber: Ka-Ka.Dec 7 2017, 3:36 AM
sanjoy accepted this revision.Dec 7 2017, 11:14 PM

lgtm

This revision is now accepted and ready to land.Dec 7 2017, 11:14 PM
This revision was automatically updated to reflect the committed changes.