[PATCH] D124321: [InstSimplify] Use canReplacePointersIfEqual to conditionally simplify '(ptr1 == ptr2) ? a : b'
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 23 01:24:06 PDT 2022
aqjune created this revision.
aqjune added reviewers: nikic, fhahn, spatel, RKSimon.
Herald added a subscriber: hiraditya.
Herald added a project: All.
aqjune requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
InstSimplify has a folding
(x == y ? a : b) => b
that is valid if the equality can lead to the conclusion.
However, if x and y are pointers, the condition must be more restrictive because x == y being true does not imply that they are truly equivalent values.
This patch fixes InstSimplify to conditionally perform the transformation if they are pointers, using canReplacePointersIfEqual.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124321
Files:
llvm/include/llvm/Analysis/Loads.h
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/lib/Analysis/Loads.cpp
llvm/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/test/Transforms/InstSimplify/select-ptr-eq.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124321.424696.patch
Type: text/x-patch
Size: 5477 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220423/648ac62f/attachment.bin>
More information about the llvm-commits
mailing list