[PATCH] D98585: [InstSimplify] Update foldings to constants to consider Q.AllowRefinement
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 13 09:25:53 PST 2021
aqjune created this revision.
aqjune added reviewers: nikic, spatel, lebedev.ri.
Herald added a subscriber: hiraditya.
aqjune requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This is a follow-up of D98391 <https://reviews.llvm.org/D98391> and fixes a few foldings from non-constants to constants to be activated only when Q.AllowRefinement is true.
Foldings from non-constants to constants are considered only, because
- They are more likely to be the source of end-to-end miscompilation than other foldings. See the example from unit test diff below
- Changing all of these at once is likely to cause significant performance regression and getting the patch reviewed isn't realistic.
After this patch, one unit test needed to be changed:
%v = select (x == 0), 0, (x & y)
=>
%v = x & y
Since SimplifyAndInst(0 & y) was returning 0, the whole formula was simplified into x & y.
This is incorrect because the result becomes more poisonous if y was poison.
Currently it does not cause end-to-end miscompilation because poison constant does not appear frequently, but this is likely to cause problem in the future.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D98585
Files:
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/InstCombine/select.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98585.330457.patch
Type: text/x-patch
Size: 5094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210313/da3ab5d0/attachment.bin>
More information about the llvm-commits
mailing list