1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/lib/Transforms
Florian Hahn fc0ecc3cd2 [SCCP] Do not replace deref'able ptr with un-deref'able one.
Currently IPSCCP (and others like CVP/GVN) blindly propagate pointer
equalities. In certain cases, that leads to dereferenceable pointers
being replaced, as in the example test case.

I think this is not allowed, as it introduces an access of an
un-dereferenceable pointer. Note that the pointer is inbounds, but one
past the last element, so it is valid, but not dereferenceable.

This patch is mostly to highlight the issue and start a discussion.
Currently it only checks for specifically looking
one-past-the-last-element pointers with array typed bases.

This causes the mis-compile outlined in
https://stackoverflow.com/questions/55754313/is-this-gcc-clang-past-one-pointer-comparison-behavior-conforming-or-non-standar

In the test case, if we replace %p with the GEP for the store, we
subsequently determine that the store and the load cannot alias, because
they are to different underlying objects.

Note that Alive2 seems to think that the replacement is valid:
https://alive2.llvm.org/ce/z/2rorhk

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D85332
2020-09-03 10:22:21 +01:00
..
AggressiveInstCombine [SVE] Remove calls to VectorType::getNumElements from AggressiveInstCombine 2020-08-14 16:40:34 -07:00
CFGuard
Coroutines Revert D85812 "[coroutine] should disable inline before calling coro split" 2020-08-24 11:41:05 -07:00
Hello
InstCombine [InstCombine] Fix a couple crashes with extractelement on a scalable vector. 2020-09-02 18:02:07 -07:00
Instrumentation [gcov] Increment counters with atomicrmw if -fsanitize=thread 2020-08-28 16:32:35 -07:00
IPO [GlobalOpt] Fix an incorrect Modified status 2020-09-02 15:00:45 +02:00
ObjCARC [ObjC][ARC] In HandlePotentialAlterRefCount, check whether an 2020-08-28 17:45:14 -07:00
Scalar [SCCP] Do not replace deref'able ptr with un-deref'able one. 2020-09-03 10:22:21 +01:00
Utils [NFC][Local] EliminateDuplicatePHINodes(): add STATISTIC() 2020-08-29 22:03:18 +03:00
Vectorize [VectorCombine][SVE] Do not fold bitcast shuffle for scalable type. 2020-09-02 15:02:16 -07:00
CMakeLists.txt
LLVMBuild.txt