OSDN Git Service

[InstCombine] Recommit: Fold (x << y) >> y -> x & (-1 >> y)
authorRoman Lebedev <lebedev.ri@gmail.com>
Fri, 15 Jun 2018 09:56:52 +0000 (09:56 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Fri, 15 Jun 2018 09:56:52 +0000 (09:56 +0000)
commitae2a6132b3b998b91943e4ef74fda37313f3145b
tree079c9cbdcfa8feddbaffd1a584f9d1039bcb27b8
parentf2c20b5ace46473db7be8073a277f57b27099be5
[InstCombine] Recommit: Fold  (x << y) >> y  ->  x & (-1 >> y)

Summary:
We already do it for splat constants, but not just values.
Also, undef cases are mostly non-functional.

The original commit was reverted because
it broke tests for amdgpu backend, which i didn't check.
Now, the backed was updated to recognize these new
patterns, so we are good.

https://bugs.llvm.org/show_bug.cgi?id=37603
https://rise4fun.com/Alive/cplX

Reviewers: spatel, craig.topper, mareko, bogner, rampitec, nhaehnle, arsenm

Reviewed By: spatel, rampitec, nhaehnle

Subscribers: wdng, nhaehnle, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334818 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineShifts.cpp
test/Transforms/InstCombine/AMDGPU/amdgcn-intrinsics.ll
test/Transforms/InstCombine/canonicalize-shl-lshr-to-masking.ll