aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugValues.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-08-29 10:26:23 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-08-29 10:26:23 +0000
commitf13b0e3ed89f4247c0dfa3147dc3a18d10c96ee8 (patch)
treeae05376466f10cfb5faa01e3f08c58cbc241f1e8 /llvm/lib/CodeGen/LiveDebugValues.cpp
parentc65204148c13d6c2cdfa018b2dd2bf8c306cc7a5 (diff)
downloadllvm-f13b0e3ed89f4247c0dfa3147dc3a18d10c96ee8.zip
llvm-f13b0e3ed89f4247c0dfa3147dc3a18d10c96ee8.tar.gz
llvm-f13b0e3ed89f4247c0dfa3147dc3a18d10c96ee8.tar.bz2
[InstCombine] Shift amount reassociation in bittest: trunc-of-lshr (PR42399)
Summary: Finally, the fold i was looking forward to :) The legality check is muddy, i doubt i've groked the full generalization, but it handles all the cases i care about, and can come up with: https://rise4fun.com/Alive/26j I.e. we can perform the fold if **any** of the following is true: * The shift amount is either zero or one less than widest bitwidth * Either of the values being shifted has at most lowest bit set * The value that is being shifted by `shl` (which is not truncated) should have no less leading zeros than the total shift amount; * The value that is being shifted by `lshr` (which **is** truncated) should have no less leading zeros than the widest bit width minus total shift amount minus one I strongly suspect there is some better generalization, but i'm not aware of it as of right now. For now i also avoided using actual `computeKnownBits()`, but restricted it to constants. Reviewers: spatel, nikic, xbolva00 Reviewed By: spatel Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66383 llvm-svn: 370324
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues.cpp')
0 files changed, 0 insertions, 0 deletions