mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user