OSDN Git Service

[InstCombine] Fold icmp eq/ne (and %x, C), 0 iff (-C) is power of two -> %x u</u...
authorHuihui Zhang <huihuiz@quicinc.com>
Tue, 25 Jun 2019 00:09:10 +0000 (00:09 +0000)
committerHuihui Zhang <huihuiz@quicinc.com>
Tue, 25 Jun 2019 00:09:10 +0000 (00:09 +0000)
commite4223f994bed2a45ea8b4d9994ba85d21cb78b4b
tree8d262cb4e26c13a8833e90f6f356dbc684a3905d
parent948b03b608f15d8497faed0d6c891b956b78304c
[InstCombine] Fold  icmp eq/ne (and %x, C), 0 iff (-C) is power of two -> %x u</u>= (-C)  earlier.

Summary:
To generate simplified IR, make sure fold
  (X & ~C) ==/!= 0 --> X u</u>= C+1

is scheduled before fold
  ((X << Y) & C) == 0 -> (X & (C >> Y)) == 0.

https://rise4fun.com/Alive/7ZN

Reviewers: lebedev.ri, efriedma, spatel, craig.topper

Reviewed By: lebedev.ri

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364255 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/lshr-and-negC-icmpeq-zero.ll
test/Transforms/InstCombine/pr17827.ll
test/Transforms/InstCombine/shl-and-negC-icmpeq-zero.ll