diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-16 04:25:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-16 04:25:26 +0000 |
commit | a74cefa6d39756f33393cdd8c1cf4d1cfb5be4c3 (patch) | |
tree | c2737d81e74286cf1e4385bd4d054535ecf92bc4 /lib/Transforms/Scalar/InstructionCombining.cpp | |
parent | faaf951fabd75e72be1e5cd6fb1ae5afe7ad14c9 (diff) |
Handle the case where there is no "not". It is possible it got
folded into the select.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59389 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index ac9fc01c20..c2df3a5b24 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -4222,9 +4222,13 @@ static Instruction *MatchSelectFromAndOr(Value *A, Value *B, // Handle "cond ? -1 : 0". if (C1->isAllOnesValue() && C2->isZero()) { // ((cond?-1:0)&C) | (B&(cond?0:-1)) -> cond ? C : B. + if (match(D, SELECT_MATCH(Cond2, 0, -1)) && Cond2 == Cond) + return SelectInst::Create(Cond, C, B); if (match(D, m_Not(SELECT_MATCH(Cond2, -1, 0))) && Cond2 == Cond) return SelectInst::Create(Cond, C, B); // ((cond?-1:0)&C) | ((cond?0:-1)&D) -> cond ? C : D. + if (match(B, SELECT_MATCH(Cond2, 0, -1)) && Cond2 == Cond) + return SelectInst::Create(Cond, C, D); if (match(B, m_Not(SELECT_MATCH(Cond2, -1, 0))) && Cond2 == Cond) return SelectInst::Create(Cond, C, D); } |