diff options
| author | Chris Lattner <sabre@nondot.org> | 2010-02-09 01:12:41 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2010-02-09 01:12:41 +0000 |
| commit | 9b6a1789e5f9d23b648d0c0ac07b38758a954cd7 (patch) | |
| tree | 7bb86d844dcc9818adc58d17efe0a0f08fdcb568 /llvm/lib | |
| parent | be2f0b2b7b833f789698f0c2d7d91bfa0607c0bb (diff) | |
| download | bcm5719-llvm-9b6a1789e5f9d23b648d0c0ac07b38758a954cd7.tar.gz bcm5719-llvm-9b6a1789e5f9d23b648d0c0ac07b38758a954cd7.zip | |
fix PR6193, only considering sign extensions *from i1* for this
xform.
llvm-svn: 95642
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index f0ddfe3fe1a..9de73bada7e 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -1142,19 +1142,24 @@ static Instruction *MatchSelectFromAndOr(Value *A, Value *B, Value *C, Value *D) { // If A is not a select of -1/0, this cannot match. Value *Cond = 0; - if (!match(A, m_SExt(m_Value(Cond)))) + if (!match(A, m_SExt(m_Value(Cond))) || + !Cond->getType()->isInteger(1)) return 0; // ((cond?-1:0)&C) | (B&(cond?0:-1)) -> cond ? C : B. - if (match(D, m_Not(m_SExt(m_Specific(Cond))))) + if (match(D, m_Not(m_SExt(m_Specific(Cond)))) && + Cond->getType()->isInteger(1)) return SelectInst::Create(Cond, C, B); - if (match(D, m_SExt(m_Not(m_Specific(Cond))))) + if (match(D, m_SExt(m_Not(m_Specific(Cond)))) && + Cond->getType()->isInteger(1)) return SelectInst::Create(Cond, C, B); // ((cond?-1:0)&C) | ((cond?0:-1)&D) -> cond ? C : D. - if (match(B, m_Not(m_SExt(m_Specific(Cond))))) + if (match(B, m_Not(m_SExt(m_Specific(Cond)))) && + Cond->getType()->isInteger(1)) return SelectInst::Create(Cond, C, D); - if (match(B, m_SExt(m_Not(m_Specific(Cond))))) + if (match(B, m_SExt(m_Not(m_Specific(Cond)))) && + Cond->getType()->isInteger(1)) return SelectInst::Create(Cond, C, D); return 0; } |

