[LVI] Fix and re-enable at-use reasoning (PR60629)
authorNikita Popov <npopov@redhat.com>
Tue, 14 Feb 2023 14:48:25 +0000 (15:48 +0100)
committerNikita Popov <npopov@redhat.com>
Tue, 14 Feb 2023 14:56:39 +0000 (15:56 +0100)
commitbfbfbd8b65def121ba325c6c68aca09349d119fc
tree1e11be4a9d486bc889a4d7e9ab20f7143b4df88e
parent0fa5df1959faaf474697fae4fd36b9749b67f815
[LVI] Fix and re-enable at-use reasoning (PR60629)

This fixes the handling of phi nodes in getConstantRangeAtUse()
and re-enables it, reverting the workaround from
c77c186a647b385c291ddabecd70a2b4f84ae342.

For phi nodes, while we can make use of the edge condition for the
incoming value, we shouldn't look past the phi node to look for
further conditions, because we might be reasoning about values
from two different cycle iterations (which will have the same
SSA value).

To handle this more specifically we would have to detect cycles,
and there doesn't seem to be any motivating case for that at this
point.
llvm/lib/Analysis/LazyValueInfo.cpp
llvm/test/Transforms/CorrelatedValuePropagation/cond-at-use.ll