OSDN Git Service

[ValueTracking] peek through shuffles in ComputeNumSignBits (PR37549)
authorSanjay Patel <spatel@rotateright.com>
Fri, 26 Oct 2018 21:05:14 +0000 (21:05 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 26 Oct 2018 21:05:14 +0000 (21:05 +0000)
commit52931b4520cfe51b3c690eec57d4e2fd1fc92d4e
tree995f3b31da074df77d8cb3e6ef50a936408f4c7a
parent556cad18dba3a3b7ed84195e3597423b3fd17080
[ValueTracking] peek through shuffles in ComputeNumSignBits (PR37549)

The motivating case is from PR37549:
https://bugs.llvm.org/show_bug.cgi?id=37549

The analysis improvement allows us to form a vector 'select' out of
bitwise logic (the use of ComputeNumSignBits was added at rL345149).

The smaller test shows another InstCombine improvement - we use
ComputeNumSignBits to add 'nsw' to shift-left. But the negative
test shows an example where we must not add 'nsw' - when the shuffle
mask contains undef elements.

Differential Revision: https://reviews.llvm.org/D53659

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345429 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/ValueTracking.cpp
test/Transforms/InstCombine/logical-select.ll
test/Transforms/InstCombine/nsw.ll