]> granicus.if.org Git - llvm/commit
Merging r322006:
authorHans Wennborg <hans@hanshq.net>
Tue, 30 Jan 2018 09:52:39 +0000 (09:52 +0000)
committerHans Wennborg <hans@hanshq.net>
Tue, 30 Jan 2018 09:52:39 +0000 (09:52 +0000)
commit029e482f3927d9c341a2a4fd0dfeff64b24b2b83
treea7c5a546bc1212026df8a7f9a37ad40966ccc174
parent6148a4925e2eef4a34f61c9f379bb81d61e8eac1
Merging r322006:
------------------------------------------------------------------------
r322006 | davide | 2018-01-08 17:34:06 +0100 (Mon, 08 Jan 2018) | 19 lines

[CVP] Replace incoming values from unreachable blocks with undef.

This is an attempt of fixing PR35807.
Due to the non-standard definition of dominance in LLVM, where uses in
unreachable blocks are dominated by anything, you can have, in an
unreachable block:

  %patatino = OP1 %patatino, CONSTANT

When `SimplifyInstruction` receives a PHI where an incoming value is of
the aforementioned form, in some cases, loops indefinitely.

What I propose here instead is keeping track of the incoming values
from unreachable blocks, and replacing them with undef. It fixes this
case, and it seems to be good regardless (even if we can't prove that
the value is constant, as it's coming from an unreachable block, we
can ignore it).

Differential Revision:  https://reviews.llvm.org/D41812
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_60@323738 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
test/Transforms/CorrelatedValuePropagation/pr35807.ll [new file with mode: 0644]