[Attributor][FIX] Ensure loop PHI replacements are dynamically unique
authorJohannes Doerfert <johannes@jdoerfert.de>
Mon, 20 Mar 2023 18:21:56 +0000 (11:21 -0700)
committerJohannes Doerfert <johannes@jdoerfert.de>
Tue, 21 Mar 2023 00:44:24 +0000 (17:44 -0700)
commit0fc63d4e642fcf79e9806dc3ae7a49defaae2479
tree0bea5f0cba4ec028816a069b5d6f8b36b4370644
parentd14ea2f6b45166f22169c82a9f73ebb404782ee5
[Attributor][FIX] Ensure loop PHI replacements are dynamically unique

Similar to loads, PHIs can be used to introduce non-dynamically unique
values into the simplification "algorithm". We need to check that PHIs
do not carry such a value from one iteration into the next as can cause
downstream reasoning to fail, e.g., downstream could think a comparison
is equal because the simplified values are equal while they are defined
in different loop iterations. Similarly, instructions in cycles are now
conservatively treated as non-dynamically unique. We could do better but
I'll leave that for the future.

The change in AAUnderlyingObjects allows us to ignore dynamically unique
when we simply look for underlying objects. The user of that AA should
be aware that the result might not be a dynamically unique value.
13 files changed:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/Attributor/IPConstantProp/PR26044.ll
llvm/test/Transforms/Attributor/dereferenceable-1.ll
llvm/test/Transforms/Attributor/heap_to_stack_gpu.ll
llvm/test/Transforms/Attributor/liveness.ll
llvm/test/Transforms/Attributor/lvi-after-jumpthreading.ll
llvm/test/Transforms/Attributor/nonnull.ll
llvm/test/Transforms/Attributor/potential.ll
llvm/test/Transforms/Attributor/range.ll
llvm/test/Transforms/Attributor/value-simplify-instances.ll
llvm/test/Transforms/Attributor/value-simplify-pointer-info.ll
llvm/test/Transforms/Attributor/willreturn.ll
llvm/test/Transforms/OpenMP/attributor_recursion_crash.ll