[NewGVN] Break infinite recursion in singleReachablePHIPath().
authorDavide Italiano <davide@freebsd.org>
Thu, 18 May 2017 23:22:44 +0000 (23:22 +0000)
committerDavide Italiano <davide@freebsd.org>
Thu, 18 May 2017 23:22:44 +0000 (23:22 +0000)
commiteab0de2b82da9b5d1c4efd782ead59a66e783248
treec0b2b43d218147f099dc7526f3cd094b2bfe7ec0
parent1cfc81f1dee741a82747270ddd8b32e76543dc32
[NewGVN] Break infinite recursion in singleReachablePHIPath().

We can have cycles between PHIs and this causes singleReachablePhi()
to call itself indefintely (until we run out of stack). The proper
solution would be that of computing SCCs, but it's not worth for
now, so just keep a visited set and give up when we find a cycle.
Thanks to Dan for the discussion/help with this.

Fixes PR33014.

llvm-svn: 303393
llvm/lib/Transforms/Scalar/NewGVN.cpp
llvm/test/Transforms/NewGVN/pr33014.ll [new file with mode: 0644]