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 | e538db4fb0ec30500da721a2a698946fa36db1a8 (patch) | |
tree | a2d9656bc6610ae8951226f5021cb29b42558e40 /lib/Transforms | |
parent | 940ab54755e690316d9ce779be7602a5f30e9aa1 (diff) | |
download | external_llvm-e538db4fb0ec30500da721a2a698946fa36db1a8.zip external_llvm-e538db4fb0ec30500da721a2a698946fa36db1a8.tar.gz external_llvm-e538db4fb0ec30500da721a2a698946fa36db1a8.tar.bz2 |
fix PR6193, only considering sign extensions *from i1* for this
xform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95642 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index f0ddfe3..9de73ba 100644 --- a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/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; } |