[InstCombine] Add simplification of two logical and/ors
authorJuneyoung Lee <aqjune@gmail.com>
Sun, 7 Mar 2021 11:27:44 +0000 (20:27 +0900)
committerJuneyoung Lee <aqjune@gmail.com>
Sun, 7 Mar 2021 17:38:43 +0000 (02:38 +0900)
commit07c3b97e184d5bd828b8a680cdce46e73f3db9fc
treedd947e3e6c6264cbd04900244fcacc97b981eca3
parentfdbd5d32060c50313493fbdbbea74dc9ea73b591
[InstCombine] Add simplification of two logical and/ors

This is a patch that adds folding of two logical and/ors that share one variable:

a && (a && b) -> a && b
a && (a & b)  -> a && b
...

This is towards removing the poison-unsafe select optimization (D93065 has more context).

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D96945
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
llvm/test/Transforms/InstCombine/select-safe-bool-transforms.ll
llvm/test/Transforms/SimplifyCFG/merge-cond-stores.ll