]> granicus.if.org Git - llvm/commit
InstCombine: Combine select sequences into a single select
authorMatthias Braun <matze@braunis.de>
Fri, 6 Feb 2015 17:49:36 +0000 (17:49 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 6 Feb 2015 17:49:36 +0000 (17:49 +0000)
commit2f2dec87fbd809c2f303cd38c92ccd2a84221b7a
treee6aba0c05e9de791db557d1fb08903840ed317de
parente81cc348ac32adec050b38d15c9e2d3c9c258c8c
InstCombine: Combine select sequences into a single select

Normalize
select(C0, select(C1, a, b), b) -> select((C0 & C1), a, b)
select(C0, a, select(C1, a, b)) -> select((C0 | C1), a, b)

This normal form may enable further combines on the And/Or and shortens
paths for the values. Many targets prefer the other but can go back
easily in CodeGen.

Differential Revision: http://reviews.llvm.org/D7399

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228409 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineSelect.cpp
test/Transforms/InstCombine/select.ll