OSDN Git Service

[InstCombine] Fold Select with binary op
authorDavid Bolvansky <david.bolvansky@gmail.com>
Mon, 30 Jul 2018 20:38:53 +0000 (20:38 +0000)
committerDavid Bolvansky <david.bolvansky@gmail.com>
Mon, 30 Jul 2018 20:38:53 +0000 (20:38 +0000)
commita5603d18b0a62461cfb0e3a07c78d5c764beac23
tree052fecfa8176784e8531cf8b575000752b3d93ad
parent3e5ff18867136e3c47a9725666e9583d2376cae9
[InstCombine] Fold Select with binary op

Summary:
Fold
  %A = icmp eq i8 %x, 0
  %B = xor i8 %x, %z
  %C = select i1 %A, i8 %B, i8 %y
To
  %C = select i1 %A, i8 %z, i8 %y

Fixes https://bugs.llvm.org/show_bug.cgi?id=38345
Proof: https://rise4fun.com/Alive/43J

Reviewers: lebedev.ri, spatel

Reviewed By: spatel

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338300 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineSelect.cpp
test/Transforms/InstCombine/select-binop-icmp.ll
test/Transforms/SimplifyCFG/merge-cond-stores.ll