diff options
| author | Nikita Popov <npopov@redhat.com> | 2023-10-30 10:05:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-30 10:05:39 +0100 |
| commit | 1770a2e325192f1665018e21200596da1904a330 (patch) | |
| tree | ff9ad8b328a5162c39cee546494c61f662ce742d /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | |
| parent | 5c8a71d82bcfd8f9d327c103aa036f1b003ca951 (diff) | |
| download | llvm-1770a2e325192f1665018e21200596da1904a330.zip llvm-1770a2e325192f1665018e21200596da1904a330.tar.gz llvm-1770a2e325192f1665018e21200596da1904a330.tar.bz2 | |
[InstCombine] Simplify and/or of icmp eq with op replacement (#70335)
and/or in logical (select) form benefit from generic simplifications via
simplifyWithOpReplaced(). However, the corresponding fold for plain
and/or currently does not exist.
Similar to selects, there are two general cases for this fold
(illustrated with `and`, but there are `or` conjugates).
The basic case is something like `(a == b) & c`, where the replacement
of a with b or b with a inside c allows it to fold to true or false.
Then the whole operation will fold to either false or `a == b`.
The second case is something like `(a != b) & c`, where the replacement
inside c allows it to fold to false. In that case, the operand can be
replaced with c, because in the case where a == b (and thus the icmp is
false), c itself will already be false.
As the test diffs show, this catches quite a lot of patterns in existing
test coverage. This also obsoletes quite a few existing special-case
and/or of icmp folds we have (e.g. simplifyAndOrOfICmpsWithLimitConst),
but I haven't removed anything as part of this patch in the interest of
risk mitigation.
Fixes #69050.
Fixes #69091.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
0 files changed, 0 insertions, 0 deletions
