diff options
author | Chris Lattner <sabre@nondot.org> | 2007-11-25 21:27:53 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-11-25 21:27:53 +0000 |
commit | cfa597569d79a8b53cc4faa9725a66e246a19866 (patch) | |
tree | b92bd5b2e6e48dbc6e0de4476777c8f902daea25 /lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | d91cbf352a5f25d602667445bcbb132705da286a (diff) |
Implement PR1822
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 85fd2c3bdb..e90d1909ae 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -7326,6 +7326,13 @@ Instruction *InstCombiner::visitSelectInst(SelectInst &SI) { return BinaryOperator::createOr(NotCond, TrueVal); } } + + // select a, b, a -> a&b + // select a, a, b -> a|b + if (CondVal == TrueVal) + return BinaryOperator::createOr(CondVal, FalseVal); + else if (CondVal == FalseVal) + return BinaryOperator::createAnd(CondVal, TrueVal); } // Selecting between two integer constants? |