[EarlyCSE] Propagate conditions of AND and OR instructions
authorMax Kazantsev <max.kazantsev@azul.com>
Thu, 14 Jun 2018 13:02:13 +0000 (13:02 +0000)
committerMax Kazantsev <max.kazantsev@azul.com>
Thu, 14 Jun 2018 13:02:13 +0000 (13:02 +0000)
commitff6d1c918886651f543fb7284921f49703e1999a
tree75982a4c3632d29b5d5cd1cc40ea80cd7e508132
parent0a2e0b6b0ed37054b6efe4be1505c64fbf9953b7
[EarlyCSE] Propagate conditions of AND and OR instructions

This patches teaches EarlyCSE to figure out that if `and i1 %x, %y` is true then both
`%x` and `%y` are true in the taken branch, and if `or i1 %x, %y` is false then both
`%x` and `%y` are false in non-taken branch. Fix for PR37635.

Differential Revision: https://reviews.llvm.org/D47574
Reviewed By: reames

llvm-svn: 334707
llvm/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/test/Transforms/EarlyCSE/and_or.ll [new file with mode: 0644]