summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-11-25 21:27:53 +0000
committerChris Lattner <sabre@nondot.org>2007-11-25 21:27:53 +0000
commitc00e8adfe0ec5149e3f952e4c99c67942c9367ef (patch)
tree8a00b643d1057518cd7357a834c81d96bc08bfad /llvm/lib/Transforms
parentbd9df0f200ed7192f46eef53b6645781e9bb1982 (diff)
downloadbcm5719-llvm-c00e8adfe0ec5149e3f952e4c99c67942c9367ef.tar.gz
bcm5719-llvm-c00e8adfe0ec5149e3f952e4c99c67942c9367ef.zip
Implement PR1822
llvm-svn: 44318
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 85fd2c3bdb7..e90d1909ae4 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/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?
OpenPOWER on IntegriCloud