Home | History | Annotate | Download | only in InstCombine

Lines Matching refs:LHS

61 ///    (sext (add LHS, RHS))  === (add (sext LHS), (sext RHS))
64 bool InstCombiner::WillNotOverflowSignedAdd(Value *LHS, Value *RHS) {
69 // have one carry bit which can change a sign. As such, if LHS and RHS each
72 if (ComputeNumSignBits(LHS) > 1 && ComputeNumSignBits(RHS) > 1)
88 Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
90 if (Value *V = SimplifyAddInst(LHS, RHS, I.hasNoSignedWrap(),
102 return BinaryOperator::CreateXor(LHS, RHS);
110 if (ZExtInst *ZI = dyn_cast<ZExtInst>(LHS))
115 if (match(LHS, m_Xor(m_Value(XorLHS), m_ConstantInt(XorRHS)))) {
142 if (LHS->hasOneUse() && (XorRHS->getValue()+1).isPowerOf2()) {
154 if (isa<Constant>(RHS) && isa<PHINode>(LHS))
159 return BinaryOperator::CreateXor(LHS, RHS);
162 if (LHS == RHS) {
164 BinaryOperator::CreateShl(LHS, ConstantInt::get(I.getType(), 1));
172 if (Value *LHSV = dyn_castNegVal(LHS)) {
184 return BinaryOperator::CreateSub(LHS, V);
188 if (Value *X = dyn_castFoldableMul(LHS, C2)) {
199 if (dyn_castFoldableMul(RHS, C2) == LHS)
200 return BinaryOperator::CreateMul(LHS, AddOne(C2));
206 ComputeMaskedBits(LHS, LHSKnownZero, LHSKnownOne);
214 return BinaryOperator::CreateOr(LHS, RHS);
221 if (match(LHS, m_Mul(m_Value(W), m_Value(X))) &&
235 Value *NewAdd = Builder->CreateAdd(X, Z, LHS->getName());
243 if (match(LHS, m_Not(m_Value(X)))) // ~X + C --> (C-1) - X
247 if (LHS->hasOneUse() &&
248 match(LHS, m_And(m_Value(X), m_ConstantInt(C2))) &&
262 Value *NewAdd = Builder->CreateAdd(X, CRHS, LHS->getName());
268 if (SelectInst *SI = dyn_cast<SelectInst>(LHS))
275 SelectInst *SI = dyn_cast<SelectInst>(LHS);
279 A = LHS;
300 if (SExtInst *LHSConv = dyn_cast<SExtInst>(LHS)) {
337 Value *LHS = I.getOperand(0), *RHS = I.getOperand(1);
344 return ReplaceInstUsesWith(I, LHS);
347 if (isa<PHINode>(LHS))
354 if (Value *LHSV = dyn_castFNegVal(LHS))
360 return BinaryOperator::CreateFSub(LHS, V);
364 if (CFP->getValueAPF().isPosZero() && CannotBeNegativeZero(LHS))
365 return ReplaceInstUsesWith(I, LHS);
369 if (SIToFPInst *LHSConv = dyn_cast<SIToFPInst>(LHS)) {
470 /// &A[10] - &A[0]: we should compile this to "10". LHS/RHS are the pointer
471 /// operands to the ptrtoint instructions for the LHS/RHS of the subtract.
473 Value *InstCombiner::OptimizePointerDifference(Value *LHS, Value *RHS,
477 // If LHS is a gep based on RHS or RHS is a gep based on LHS, we can optimize
484 if (GEPOperator *LHSGEP = dyn_cast<GEPOperator>(LHS)) {
502 if (RHSGEP->getOperand(0) == LHS) {
505 } else if (GEPOperator *LHSGEP = dyn_cast<GEPOperator>(LHS)) {