llvm-mirror/test/Transforms/CorrelatedValuePropagation
Nikita Popov 4e796fd7b6 Reapply [LVI] Normalize pointer behavior
This got reverted because a dependency was reverted. It has since
been reapplied, so reapply this as well.

-----

Related to D69686. As noted there, LVI currently behaves differently
for integer and pointer values: For integers, the block value is always
valid inside the basic block, while for pointers it is only valid at
the end of the basic block. I believe the integer behavior is the
correct one, and CVP relies on it via its getConstantRange() uses.

The reason for the special pointer behavior is that LVI checks whether
a pointer is dereferenced in a given basic block and marks it as
non-null in that case. Of course, this information is valid only after
the dereferencing instruction, or in conservative approximation,
at the end of the block.

This patch changes the treatment of dereferencability: Instead of
including it inside the block value, we instead treat it as something
similar to an assume (it essentially is a non-nullness assume) and
incorporate this information in intersectAssumeOrGuardBlockValueConstantRange()
if the context instruction is the terminator of the basic block.
This happens either when determining an edge-value internally in LVI,
or when a terminator was explicitly passed to getValueAt(). The latter
case makes this more powerful than the previous implementation as
a side-effect, and this does actually seem benefitial in practice.

Of course, we do not want to recompute dereferencability on each
intersectAssume call, so we need a new cache for this. The
dereferencability analysis requires walking the entire basic block
and computing underlying objects of all memory operands. This was
previously done separately for each queried pointer value. In the
new implementation (both because this makes the caching simpler,
and because it is faster), I instead only walk the full BB once and
cache all the dereferenced pointers. So the traversal is now performed
only once per BB, instead of once per queried pointer value.

I think the overall model now makes more sense than before, and there
will be no more pitfalls due to differing integer/pointer behavior.

Differential Revision: https://reviews.llvm.org/D69914
2020-08-29 21:17:03 +02:00
..
2010-09-02-Trunc.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
2010-09-26-MergeConstantRange.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
add.ll [CorrelatedValuePropagation] Mark subs that we know not to wrap with nuw/nsw. 2019-04-20 13:14:18 +00:00
alloca.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
and.ll [CVP] Remove a masking operation if range information implies it's a noop 2019-10-11 03:48:56 +00:00
ashr.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
basic.ll [CVP] Reenable nowrap flag inference 2019-06-24 20:13:13 +00:00
conflict.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
crash.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
deopt.ll [CVP] Reenable nowrap flag inference 2019-06-24 20:13:13 +00:00
guards.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
icmp.ll [LVI][CVP] Handle (x | y) < C style conditions 2020-07-01 20:43:24 +02:00
merge-range-and-undef.ll [ValueLattice] Distinguish between constant ranges with/without undef. 2020-03-31 12:50:20 +01:00
minmaxabs.ll [ConstantRange][CVP] Make use of abs poison flag 2020-07-30 23:06:10 +02:00
mul.ll [CVP] Deduce no-wrap on mul 2019-10-21 08:21:44 +00:00
non-null.ll Reapply [LVI] Normalize pointer behavior 2020-08-29 21:17:03 +02:00
overflow_predicate.ll [LVI][CVP] Calculate with.overflow result range 2019-05-25 09:53:45 +00:00
overflows.ll [CVP] After proving that @llvm.with.overflow()/@llvm.sat() don't overflow, also try to prove other no-wrap 2019-10-18 19:32:47 +00:00
phi-common-val.ll Infer alignment of unmarked loads in IR/bitcode parsing. 2020-05-14 13:03:50 -07:00
pointer.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
pr35807.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
profmd.ll Resubmit "[CorrelatedValuePropagation] Fix prof branch_weights metadata handling for SwitchInst" 2019-06-05 05:46:40 +00:00
range.ll Infer alignment of unmarked loads in IR/bitcode parsing. 2020-05-14 13:03:50 -07:00
sdiv.ll [CVP] Soften SDiv into a UDiv as long as we know domains of both of the operands. 2020-07-18 17:59:56 +03:00
select.ll [JT][CVP] Regenerate test checks, again 2019-11-01 22:27:48 +01:00
sext.ll [CVP} Replace SExt with ZExt if the input is known-non-negative 2019-10-08 20:29:48 +00:00
shl.ll [CVP] No-wrap deduction for shl 2019-10-21 21:31:19 +00:00
srem.ll Revert "Temporarily Revert "Add basic loop fusion pass."" 2019-04-17 04:52:47 +00:00
sub.ll [ValueLattice] Merging unknown with empty CR is unknown. 2020-04-25 13:43:34 +01:00
udiv.ll [llvm] Fix broken cases of 'CHECK[^:]*$' in tests 2020-01-28 09:52:59 -07:00
urem.ll [llvm] Fix broken cases of 'CHECK[^:]*$' in tests 2020-01-28 09:52:59 -07:00