summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-07-30 15:28:22 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-07-30 15:28:22 +0000
commitbe612ea471bf3cef443f04588434b1648c27d532 (patch)
tree788589941730b5424b84d5401195206bb11d45dd /lldb/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py
parentc960c0a4915b18592691288c14d2cebd806197a9 (diff)
downloadbcm5719-llvm-be612ea471bf3cef443f04588434b1648c27d532.tar.gz
bcm5719-llvm-be612ea471bf3cef443f04588434b1648c27d532.zip
[InstCombine] Fold "x ?% y ==/!= 0" to "x & (y-1) ==/!= 0" iff y is power-of-two
Summary: I have stumbled into this by accident while preparing to extend backend `x s% C ==/!= 0` handling. While we did happen to handle this fold in most of the cases, the folding is indirect - we fold `x u% y` to `x & (y-1)` (iff `y` is power-of-two), or first turn `x s% -y` to `x u% y`; that does handle most of the cases. But we can't turn `x s% INT_MIN` to `x u% -INT_MIN`, and thus we end up being stuck with `(x s% INT_MIN) == 0`. There is no such restriction for the more general fold: https://rise4fun.com/Alive/IIeS To be noted, the fold does not enforce that `y` is a constant, so it may indeed increase instruction count. This is consistent with what `x u% y`->`x & (y-1)` already does. I think it makes sense, it's at most one (simple) extra instruction, while `rem`ainder is really much more un-simple (and likely **very** costly). Reviewers: spatel, RKSimon, nikic, xbolva00, craig.topper Reviewed By: RKSimon Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D65046 llvm-svn: 367322
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud