]> granicus.if.org Git - llvm/commit
[CVP] Convert an AShr to a LShr if 1st operand is known to be nonnegative.
authorChad Rosier <mcrosier@codeaurora.org>
Wed, 12 Oct 2016 13:41:38 +0000 (13:41 +0000)
committerChad Rosier <mcrosier@codeaurora.org>
Wed, 12 Oct 2016 13:41:38 +0000 (13:41 +0000)
commit7e18f7d8ed019d32bdc75d00c50f4cc74a90ba27
tree7bea27c621bfb94db565119dc1e6c462af5a8c9c
parent1a62037b4342c629ca7e9f1f1518bbe7825e99a1
[CVP] Convert an AShr to a LShr if 1st operand is known to be nonnegative.

An arithmetic shift can be safely changed to a logical shift if the first
operand is known positive. This allows ComputeKnownBits (and similar analysis)
to determine the sign bit of the shifted value in some cases. In turn, this
allows InstCombine to canonicalize a signed comparison (a > 0) into an equality
check (a != 0).

PR30577

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@284013 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/CorrelatedValuePropagation.cpp
test/Transforms/CorrelatedValuePropagation/ashr.ll [new file with mode: 0644]