|
LLVM
3.7.0
|
The core instruction combiner logic. More...
#include <InstCombineInternal.h>
Public Types | |
| typedef IRBuilder< true, TargetFolder, InstCombineIRInserter > | BuilderTy |
| An IRBuilder that automatically inserts new instructions into the worklist. More... | |
Public Attributes | |
| InstCombineWorklist & | Worklist |
| A worklist of the instructions that need to be simplified. More... | |
| BuilderTy * | Builder |
The core instruction combiner logic.
This class provides both the logic to recursively visit instructions and combine them, as well as the pass infrastructure for running this as part of the LLVM pass pipeline.
Definition at line 165 of file InstCombineInternal.h.
An IRBuilder that automatically inserts new instructions into the worklist.
Definition at line 174 of file InstCombineInternal.h.
|
inline |
Definition at line 197 of file InstCombineInternal.h.
| Instruction * InstCombiner::commonCastTransforms | ( | CastInst & | CI | ) |
Implement the transforms common to all CastInst visitors.
Definition at line 289 of file InstCombineCasts.cpp.
References llvm::CastInst::Create(), llvm::DL, llvm::CastInst::getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), isEliminableCastPair(), llvm::Type::isIntegerTy(), llvm::AArch64CC::NV, and SI.
| Instruction* llvm::InstCombiner::commonDivTransforms | ( | BinaryOperator & | I | ) |
| Instruction * InstCombiner::commonIDivTransforms | ( | BinaryOperator & | I | ) |
This function implements the transforms common to both integer division instructions (udiv and sdiv).
It is called by the visitors to those integer division instructions. Common integer divide transforms
Definition at line 783 of file InstCombineMulDivRem.cpp.
References llvm::BinaryOperator::Create(), llvm::SelectInst::Create(), llvm::ConstantInt::get(), llvm::APInt::getBitWidth(), llvm::APInt::getLimitedValue(), llvm::APInt::getOneBitSet(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), I, llvm::BinaryOperator::isExact(), llvm::Type::isIntegerTy(), IsMultiple(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_NSWMul(), llvm::PatternMatch::m_NSWShl(), llvm::PatternMatch::m_NUWMul(), llvm::PatternMatch::m_NUWShl(), llvm::PatternMatch::m_SDiv(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_SRem(), llvm::PatternMatch::m_Sub(), llvm::PatternMatch::m_UDiv(), llvm::PatternMatch::m_URem(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), MultiplyOverflows(), llvm::AArch64CC::NV, One, llvm::BinaryOperator::setHasNoSignedWrap(), llvm::BinaryOperator::setHasNoUnsignedWrap(), llvm::BinaryOperator::setIsExact(), llvm::User::setOperand(), SI, simplifyValueKnownNonZero(), and X.
| Instruction * InstCombiner::commonIRemTransforms | ( | BinaryOperator & | I | ) |
This function implements the transforms common to both integer remainder instructions (urem and srem).
It is called by the visitors to those integer remainder instructions. Common integer remainder transforms
Definition at line 1341 of file InstCombineMulDivRem.cpp.
References llvm::User::getOperand(), I, llvm::AArch64CC::NV, llvm::User::setOperand(), SI, and simplifyValueKnownNonZero().
| Instruction * InstCombiner::commonPointerCastTransforms | ( | CastInst & | CI | ) |
Implement the transforms for cast of pointer (bitcast/ptrtoint)
Definition at line 1443 of file InstCombineCasts.cpp.
References GEP, llvm::User::getOperand(), and llvm::User::setOperand().
| Instruction* llvm::InstCombiner::commonRemTransforms | ( | BinaryOperator & | I | ) |
| Instruction * InstCombiner::commonShiftTransforms | ( | BinaryOperator & | I | ) |
Definition at line 24 of file InstCombineShifts.cpp.
References llvm::ARM_PROC::A, llvm::ConstantInt::get(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Value::getType(), I, llvm::PatternMatch::m_Power2(), llvm::PatternMatch::m_SRem(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::User::setOperand(), and SI.
|
inline |
Definition at line 464 of file InstCombineInternal.h.
References llvm::computeKnownBits(), and llvm::DL.
|
inline |
Definition at line 474 of file InstCombineInternal.h.
References llvm::ComputeNumSignBits(), and llvm::DL.
Referenced by ProcessUGT_ADDCST_ADD().
|
inline |
Definition at line 487 of file InstCombineInternal.h.
References llvm::computeOverflowForUnsignedAdd(), and llvm::DL.
|
inline |
Definition at line 483 of file InstCombineInternal.h.
References llvm::computeOverflowForUnsignedMul(), and llvm::DL.
|
inline |
Definition at line 478 of file InstCombineInternal.h.
References llvm::ComputeSignBit(), and llvm::DL.
Referenced by canReplaceGEPIdxWithZero().
|
inline |
Creates a result tuple for an overflow intrinsic II with a given Result and a constant Overflow value.
Definition at line 434 of file InstCombineInternal.h.
References llvm::InsertValueInst::Create(), llvm::ConstantStruct::get(), llvm::UndefValue::get(), llvm::Value::getType(), llvm::AArch64DB::ST, and llvm::Struct.
| bool InstCombiner::dominatesAllUses | ( | const Instruction * | DI, |
| const Instruction * | UI, | ||
| const BasicBlock * | DB | ||
| ) | const |
Check that one use is in the same block as the definition and all other uses are in blocks dominated by a given block.
| DI | Definition |
| UI | Use |
| DB | Block that must dominate all uses of DI outside the parent block |
UI is the only use of DI in the parent block and all other uses of DI are in blocks dominated by DB. Definition at line 2525 of file InstCombineCompares.cpp.
References llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), and llvm::Value::users().
|
inline |
Combiner aware instruction erasure.
When dealing with an instruction that has side effects or produces a void value, we can't rely on DCE to delete the instruction. Instead, visit methods should return the value returned by this function.
Definition at line 447 of file InstCombineInternal.h.
References llvm::dbgs(), DEBUG, llvm::Instruction::eraseFromParent(), llvm::User::getNumOperands(), llvm::User::op_begin(), llvm::User::op_end(), and llvm::Value::use_empty().
Referenced by combineLoadToOperationType(), visitAllocaInst(), and visitStoreInst().
FoldAndOfFCmps - Optimize (fcmp)&(fcmp).
NOTE: Unlike the rest of instcombine, this returns a Value which should already be inserted into the function.
Definition at line 1129 of file InstCombineAndOrXor.cpp.
References llvm::CmpInst::FCMP_FALSE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_TRUE, llvm::ConstantInt::get(), getFCmpCode(), getFCmpValue(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::CmpInst::makeCmpResultType(), and std::swap().
FoldAndOfICmps - Fold (icmp)&(icmp) if possible.
Definition at line 883 of file InstCombineAndOrXor.cpp.
References llvm::AddOne(), llvm::dyn_cast(), foldLogOpOfMaskedICmps(), llvm::ConstantInt::get(), llvm::IntegerType::getBitWidth(), llvm::Type::getContext(), llvm::getICmpCode(), llvm::APInt::getLowBitsSet(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), getNewICmpValue(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::ConstantInt::getType(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::Value::hasOneUse(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::ConstantRange::intersectWith(), llvm::APInt::isAllOnesValue(), llvm::ConstantRange::isEmptySet(), llvm::ICmpInst::isEquality(), llvm::Constant::isNullValue(), llvm::APInt::isPowerOf2(), llvm::CmpInst::isSigned(), llvm::ConstantInt::isZero(), llvm_unreachable, llvm::PatternMatch::m_And(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::ConstantRange::makeAllowedICmpRegion(), llvm::CmpInst::makeCmpResultType(), llvm::PatternMatch::match(), N, llvm::PredicatesFoldable(), llvm::APInt::sgt(), llvm::SubOne(), std::swap(), llvm::ICmpInst::swapOperands(), llvm::APInt::ugt(), and llvm::APInt::zext().
| Instruction * InstCombiner::FoldCmpLoadFromIndexedGlobal | ( | GetElementPtrInst * | GEP, |
| GlobalVariable * | GV, | ||
| CmpInst & | ICI, | ||
| ConstantInt * | AndCst = nullptr |
||
| ) |
FoldCmpLoadFromIndexedGlobal - Called we see this pattern: cmp pred (load (gep GV, ...)), cmpcst where GV is a global variable with a constant initializer.
Try to simplify this into some simple computation that does not need the load. For example we can optimize "icmp eq (load (gep "foo", 0, i)), 0" into "icmp eq i, 3".
If AndCst is non-null, then the loaded value is masked with that constant before doing the comparison. This handles cases like "A[i]&4 == 0".
TrueRangeEnd/FalseRangeEnd - In conjunction with First*Element, these define a state machine that triggers for ranges of values that the index is true or false for. This triggers on things like "abbbbc"[i] == 'b'. This is -2 when undefined, -3 when overdefined, and otherwise the last index in the range (inclusive). We use -2 for undefined here because we use relative comparisons and don't want 0-1 to match -1.
Definition at line 230 of file InstCombineCompares.cpp.
References llvm::ConstantFoldCompareInstOperands(), llvm::DL, llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::ConstantInt::get(), llvm::Constant::getAggregateElement(), llvm::ConstantExpr::getAnd(), llvm::Type::getArrayElementType(), llvm::Type::getArrayNumElements(), llvm::Value::getContext(), llvm::ConstantExpr::getExtractValue(), llvm::GlobalVariable::getInitializer(), llvm::Type::getIntegerBitWidth(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::Type::getPrimitiveSizeInBits(), llvm::Intrinsic::getType(), llvm::Value::getType(), llvm::GetElementPtrInst::getType(), llvm::ConstantInt::getZExtValue(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::GetElementPtrInst::isInBounds(), isZero(), and llvm::SmallVectorTemplateBase< T, isPodLike >::push_back().
| Instruction * InstCombiner::FoldFCmp_IntToFP_Cst | ( | FCmpInst & | I, |
| Instruction * | LHSI, | ||
| Constant * | RHSC | ||
| ) |
FoldFCmp_IntToFP_Cst - Fold fcmp ([us]itofp x, cst) if possible.
Definition at line 3687 of file InstCombineCompares.cpp.
References llvm::APFloat::cmpEqual, llvm::APFloat::cmpGreaterThan, llvm::APFloat::cmpLessThan, llvm::APFloat::compare(), llvm::APFloat::convertFromAPInt(), llvm::APFloat::convertToInteger(), llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGE, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULE, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, llvm::IntegerType::getBitWidth(), llvm::Type::getFPMantissaWidth(), llvm::ConstantExpr::getFPToSI(), llvm::ConstantExpr::getFPToUI(), llvm::APInt::getMaxValue(), llvm::APInt::getMinValue(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::Type::getScalarSizeInBits(), llvm::APFloat::getSemantics(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::ConstantExpr::getSIToFP(), llvm::Value::getType(), llvm::ConstantExpr::getUIToFP(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm::FCmpInst::isEquality(), llvm::APFloat::isNaN(), llvm::APFloat::isNegative(), llvm::APFloat::isPosZero(), llvm::APFloat::isZero(), llvm_unreachable, P, llvm::APFloat::rmNearestTiesToEven, and llvm::APFloat::roundToIntegral().
| Value * InstCombiner::foldFMulConst | ( | Instruction * | FMulOrDiv, |
| Constant * | C, | ||
| Instruction * | InsertBefore | ||
| ) |
foldFMulConst() is a helper routine of InstCombiner::visitFMul().
The input FMulOrDiv is a FMul/FDiv with one and only one operand being a constant (i.e. isFMulOrFDivWithConstant(FMulOrDiv) == true). This function is to simplify "FMulOrDiv * C" and returns the resulting expression. Note that this function could return NULL in case the constants cannot be folded into a normal floating-point.
Definition at line 479 of file InstCombineMulDivRem.cpp.
References llvm::dyn_cast(), F(), llvm::ConstantExpr::getFDiv(), llvm::ConstantExpr::getFMul(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Value::hasOneUse(), isFMulOrFDivWithConstant(), and isNormalFp().
| Instruction * InstCombiner::FoldGEPICmp | ( | GEPOperator * | GEPLHS, |
| Value * | RHS, | ||
| ICmpInst::Predicate | Cond, | ||
| Instruction & | I | ||
| ) |
FoldGEPICmp - Fold comparisons between a GEP instruction and something else.
At this point we know that the GEP is on the LHS of the comparison.
Definition at line 607 of file InstCombineCompares.cpp.
References llvm::DL, llvm::EmitGEPOffset(), EvaluateGEPOffsetExpression(), llvm::Constant::getNullValue(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::ICmpInst::getSignedPredicate(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::GEPOperator::hasAllConstantIndices(), llvm::GEPOperator::hasAllZeroIndices(), llvm::Value::hasOneUse(), I, llvm::GEPOperator::isInBounds(), llvm::CmpInst::isSigned(), llvm::CmpInst::isTrueWhenEqual(), and llvm::Value::stripPointerCasts().
| Instruction * InstCombiner::FoldICmpAddOpCst | ( | Instruction & | ICI, |
| Value * | X, | ||
| ConstantInt * | CI, | ||
| ICmpInst::Predicate | Pred | ||
| ) |
FoldICmpAddOpCst - Fold "icmp pred (X+CI), X".
Definition at line 741 of file InstCombineCompares.cpp.
References llvm::ConstantInt::get(), llvm::Constant::getAllOnesValue(), llvm::Value::getContext(), llvm::ConstantExpr::getNeg(), llvm::Type::getPrimitiveSizeInBits(), llvm::APInt::getSignedMaxValue(), llvm::ConstantExpr::getSub(), llvm::ConstantInt::getType(), llvm::ConstantInt::getValue(), llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, and llvm::CmpInst::ICMP_ULT.
| Instruction * InstCombiner::FoldICmpCstShlCst | ( | ICmpInst & | I, |
| Value * | Op, | ||
| Value * | A, | ||
| ConstantInt * | CI1, | ||
| ConstantInt * | CI2 | ||
| ) |
FoldICmpCstShlCst - Handle "(icmp eq/ne (shl const2, A), const1)" -> (icmp eq/ne A, TrailingZeros(const1) - TrailingZeros(const2)).
Definition at line 1096 of file InstCombineCompares.cpp.
References llvm::APInt::countTrailingZeros(), llvm::ConstantInt::get(), llvm::APInt::getBitWidth(), llvm::CmpInst::getInversePredicate(), llvm::Constant::getNullValue(), llvm::CmpInst::getPredicate(), llvm::Value::getType(), llvm::ConstantInt::getValue(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_UGE, llvm::ICmpInst::isEquality(), and llvm::APInt::shl().
| Instruction * InstCombiner::FoldICmpCstShrCst | ( | ICmpInst & | I, |
| Value * | Op, | ||
| Value * | A, | ||
| ConstantInt * | CI1, | ||
| ConstantInt * | CI2 | ||
| ) |
FoldICmpCstShrCst - Handle "(icmp eq/ne (ashr/lshr const2, A), const1)" -> (icmp eq/ne A, Log2(const2/const1)) -> (icmp eq/ne A, Log2(const2) - Log2(const1)).
Definition at line 1036 of file InstCombineCompares.cpp.
References llvm::APInt::ashr(), llvm::ConstantInt::get(), llvm::CmpInst::getInversePredicate(), llvm::Constant::getNullValue(), llvm::CmpInst::getPredicate(), llvm::Value::getType(), llvm::ConstantInt::getValue(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_UGT, llvm::APInt::isAllOnesValue(), llvm::ICmpInst::isEquality(), llvm::APInt::isNegative(), llvm::APInt::logBase2(), llvm::APIntOps::logBase2(), llvm::APInt::lshr(), and llvm::APInt::sgt().
| Instruction * InstCombiner::FoldICmpDivCst | ( | ICmpInst & | ICI, |
| BinaryOperator * | DivI, | ||
| ConstantInt * | DivRHS | ||
| ) |
FoldICmpDivCst - Fold "icmp pred, ([su]div X, DivRHS), CmpRHS" where DivRHS and CmpRHS are both known to be integer constants.
If the division is known to be exact, then there is no remainder from the divide, so the covered range size is unit, otherwise it is the divisor.
Definition at line 790 of file InstCombineCompares.cpp.
References llvm::AddOne(), AddWithOverflow(), llvm::ConstantExpr::getMul(), llvm::ConstantExpr::getNeg(), getOne(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::ConstantExpr::getSDiv(), llvm::CmpInst::getSwappedPredicate(), llvm::ConstantExpr::getUDiv(), llvm::ConstantInt::getValue(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::Constant::isAllOnesValue(), llvm::ICmpInst::isEquality(), llvm::BinaryOperator::isExact(), llvm::ConstantInt::isNegative(), llvm::ConstantInt::isOne(), llvm::CmpInst::isSigned(), llvm::APInt::isStrictlyPositive(), llvm::ConstantInt::isZero(), llvm_unreachable, llvm::User::setOperand(), llvm::SubOne(), SubWithOverflow(), and X.
| Instruction * InstCombiner::FoldICmpShrCst | ( | ICmpInst & | ICI, |
| BinaryOperator * | DivI, | ||
| ConstantInt * | DivRHS | ||
| ) |
FoldICmpShrCst - Handle "icmp(([al]shr X, cst1), cst2)".
Definition at line 947 of file InstCombineCompares.cpp.
References llvm::APIntOps::And(), llvm::APInt::ashr(), llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::APInt::getBitWidth(), llvm::APInt::getHighBitsSet(), llvm::ConstantInt::getLimitedValue(), llvm::Value::getName(), llvm::APInt::getOneBitSet(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::CmpInst::ICMP_NE, llvm::ICmpInst::isEquality(), llvm::BinaryOperator::isExact(), llvm::CmpInst::isSigned(), llvm::APInt::lshr(), and llvm::User::setOperand().
| Instruction * InstCombiner::FoldItoFPtoI | ( | Instruction & | FI | ) |
Definition at line 1351 of file InstCombineCasts.cpp.
References llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), and fuzzer::min().
FoldOrOfFCmps - Optimize (fcmp)|(fcmp).
NOTE: Unlike the rest of instcombine, this returns a Value which should already be inserted into the function.
Definition at line 2026 of file InstCombineAndOrXor.cpp.
References llvm::CmpInst::FCMP_FALSE, llvm::CmpInst::FCMP_TRUE, llvm::CmpInst::FCMP_UNO, llvm::ConstantInt::get(), getFCmpCode(), getFCmpValue(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::CmpInst::makeCmpResultType(), and std::swap().
| Value * InstCombiner::FoldOrOfICmps | ( | ICmpInst * | LHS, |
| ICmpInst * | RHS, | ||
| Instruction * | CxtI | ||
| ) |
FoldOrOfICmps - Fold (icmp)|(icmp) if possible.
Definition at line 1692 of file InstCombineAndOrXor.cpp.
References llvm::ARM_PROC::A, llvm::AddOne(), llvm::APIntOps::And(), llvm::DL, llvm::dyn_cast(), foldLogOpOfMaskedICmps(), llvm::ConstantInt::get(), llvm::getICmpCode(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), getNewICmpValue(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::ConstantInt::getSigned(), llvm::ConstantExpr::getSub(), llvm::ConstantInt::getType(), llvm::ConstantInt::getValue(), llvm::Value::hasOneUse(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::ICmpInst::isEquality(), llvm::isKnownToBeAPowerOfTwo(), llvm::APInt::isPowerOf2(), llvm::CmpInst::isSigned(), llvm::ConstantInt::isZero(), llvm_unreachable, llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::PredicatesFoldable(), llvm::APInt::sgt(), llvm::SubOne(), std::swap(), llvm::ICmpInst::swapOperands(), llvm::APInt::ugt(), llvm::APInt::ule(), llvm::APInt::ult(), and llvm::APIntOps::Xor().
| Instruction * InstCombiner::FoldOrWithConstants | ( | BinaryOperator & | I, |
| Value * | Op, | ||
| Value * | A, | ||
| Value * | B, | ||
| Value * | C | ||
| ) |
FoldOrWithConstants - This helper function folds:
((A | B) & C1) | (B & C2)
into:
(A & C1) | B
when the XOR of the two constants is "all ones" (-1).
Definition at line 2092 of file InstCombineAndOrXor.cpp.
References llvm::dyn_cast(), llvm::ConstantInt::getValue(), llvm::APInt::isAllOnesValue(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and llvm::APIntOps::Xor().
| Instruction * InstCombiner::FoldSelectIntoOp | ( | SelectInst & | SI, |
| Value * | TrueVal, | ||
| Value * | FalseVal | ||
| ) |
FoldSelectIntoOp - Try fold the select into one of the operands to facilitate further optimization.
Definition at line 202 of file InstCombineSelect.cpp.
References llvm::BinaryOperator::Create(), llvm::SelectInst::getCondition(), llvm::BinaryOperator::getOpcode(), GetSelectFoldableConstant(), GetSelectFoldableOperands(), llvm::BinaryOperator::hasNoSignedWrap(), llvm::BinaryOperator::hasNoUnsignedWrap(), llvm::BinaryOperator::isExact(), isSelect01(), llvm::BinaryOperator::setIsExact(), and llvm::Value::takeName().
| Instruction * InstCombiner::FoldSelectOpOp | ( | SelectInst & | SI, |
| Instruction * | TI, | ||
| Instruction * | FI | ||
| ) |
FoldSelectOpOp - Here we have (select c, TI, FI), and we know that TI and FI have the same opcode and only one use each.
Try to simplify this.
Definition at line 115 of file InstCombineSelect.cpp.
References llvm::BinaryOperator::Create(), llvm::CastInst::Create(), llvm::SelectInst::getCondition(), llvm::Value::getName(), llvm::User::getNumOperands(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), llvm::Instruction::isCast(), llvm::Instruction::isCommutative(), llvm::Type::isVectorTy(), and llvm_unreachable.
| Instruction * InstCombiner::FoldShiftByConstant | ( | Value * | Op0, |
| Constant * | Op1, | ||
| BinaryOperator & | I | ||
| ) |
Definition at line 321 of file InstCombineShifts.cpp.
References llvm::APIntOps::And(), llvm::tgtok::Bits, CanEvaluateShifted(), llvm::BinaryOperator::Create(), CreateMul(), llvm::dbgs(), DEBUG, llvm::DL, llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::ConstantExpr::get(), llvm::Value::getContext(), llvm::APInt::getHighBitsSet(), llvm::ConstantInt::getLimitedValue(), llvm::APInt::getLowBitsSet(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), GetShiftedValue(), llvm::ConstantExpr::getShl(), llvm::ConstantVector::getSplat(), llvm::Value::getType(), llvm::ConstantExpr::getZExt(), llvm::ConstantInt::getZExtValue(), llvm::BinaryOperator::hasNoSignedWrap(), llvm::BinaryOperator::hasNoUnsignedWrap(), llvm::Value::hasOneUse(), I, llvm::BinaryOperator::isExact(), llvm::Instruction::isLogicalShift(), llvm::Instruction::isShift(), llvm::APInt::lshr(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Shr(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::AArch64CC::NV, llvm::APIntOps::Or(), llvm::BinaryOperator::setHasNoSignedWrap(), llvm::BinaryOperator::setHasNoUnsignedWrap(), llvm::BinaryOperator::setIsExact(), SI, llvm::Value::takeName(), llvm::ConstantInt::uge(), llvm::NVPTX::PTXLdStInstCode::V2, X, and llvm::APIntOps::Xor().
| Instruction* llvm::InstCombiner::FoldSPFofSPF | ( | Instruction * | Inner, |
| SelectPatternFlavor | SPF1, | ||
| Value * | A, | ||
| Value * | B, | ||
| Instruction & | Outer, | ||
| SelectPatternFlavor | SPF2, | ||
| Value * | C | ||
| ) |
| Instruction * InstCombiner::FoldXorWithConstants | ( | BinaryOperator & | I, |
| Value * | Op, | ||
| Value * | A, | ||
| Value * | B, | ||
| Value * | C | ||
| ) |
This helper function folds:
((A | B) & C1) ^ (B & C2)
into:
(A & C1) ^ B
when the XOR of the two constants is "all ones" (-1).
Definition at line 2121 of file InstCombineAndOrXor.cpp.
References llvm::dyn_cast(), llvm::ConstantInt::getValue(), llvm::APInt::isAllOnesValue(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and llvm::APIntOps::Xor().
|
inline |
Definition at line 209 of file InstCombineInternal.h.
Referenced by simplifyValueKnownNonZero().
|
inline |
Definition at line 211 of file InstCombineInternal.h.
References llvm::DL.
Referenced by canReplaceGEPIdxWithZero(), combineLoadToOperationType(), OptimizeIntegerToVectorInsertions(), simplifyAllocaArraySize(), and simplifyValueKnownNonZero().
|
inline |
Definition at line 213 of file InstCombineInternal.h.
Referenced by simplifyValueKnownNonZero().
|
inline |
Definition at line 215 of file InstCombineInternal.h.
|
inline |
Definition at line 217 of file InstCombineInternal.h.
Referenced by GetShiftedValue().
|
inline |
Inserts an instruction New before instruction Old.
Also adds the new instruction to the worklist and returns New so that it is suitable for use as the return from the visitation patterns.
Definition at line 392 of file InstCombineInternal.h.
References llvm::BasicBlock::getInstList(), llvm::Instruction::getParent(), and llvm::iplist< NodeTy, Traits >::insert().
Referenced by simplifyAllocaArraySize().
|
inline |
Same as InsertNewInstBefore, but also sets the debug loc.
Definition at line 402 of file InstCombineInternal.h.
References llvm::Instruction::getDebugLoc(), and llvm::Instruction::setDebugLoc().
|
inline |
Definition at line 470 of file InstCombineInternal.h.
References llvm::DL, and llvm::MaskedValueIsZero().
Optimize pointer differences into the same array into a size.
Consider: &A[10] - &A[0]: we should compile this to "10". LHS/RHS are the pointer operands to the ptrtoint instructions for the LHS/RHS of the subtract.
Definition at line 1429 of file InstCombineAddSub.cpp.
References llvm::EmitGEPOffset().
| bool InstCombiner::replacedSelectWithOperand | ( | SelectInst * | SI, |
| const ICmpInst * | Icmp, | ||
| const unsigned | SIOpd | ||
| ) |
True when a select result is replaced by one of its operands in select-icmp sequence.
This will eventually result in the elimination of the select.
| SI | Select instruction |
| Icmp | Compare instruction |
| SIOpd | Operand that replaces the select |
Notes:
Example:
entry: %4 = select i1 %3, C* %0, C* null %5 = icmp eq C* %4, null br i1 %5, label %9, label %7 ... ; <label>:7 ; preds = entry %8 = getelementptr inbounds C* %4, i64 0, i32 0 ...
can be transformed to
%5 = icmp eq C* %0, null %6 = select i1 %3, i1 %5, i1 true br i1 %6, label %9, label %7 ... ; <label>:7 ; preds = entry %8 = getelementptr inbounds C* %0, i64 0, i32 0 // replace by %0!
Similar when the first operand of the select is a constant or/and the compare is for not equal rather than equal.
NOTE: The function is only called when the select and compare constants are equal, the optimization can work only for EQ predicates. This is not a major restriction since a NE compare should be 'normalized' to an equal compare, which usually happens in the combiner and test case select-cmp-br.ll checks for it.
Definition at line 2607 of file InstCombineCompares.cpp.
References llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::CmpInst::getPredicate(), llvm::TerminatorInst::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::BasicBlock::getUniquePredecessor(), llvm::CmpInst::ICMP_EQ, isChainSelectCmpBranch(), and llvm::Value::replaceUsesOutsideBlock().
|
inline |
A combiner-aware RAUW-like routine.
This method is to be used when an instruction is found to be dead, replacable with another preexisting expression. Here we add all uses of I to the worklist, replace all uses of I with the new value, then return I, so that the inst combiner will know that I was modified.
Definition at line 413 of file InstCombineInternal.h.
References llvm::dbgs(), DEBUG, llvm::UndefValue::get(), llvm::Value::getType(), I, llvm::Value::replaceAllUsesWith(), and llvm::Value::use_empty().
Referenced by ProcessUGT_ADDCST_ADD(), ProcessUMulZExtIdiom(), simplifyAllocaArraySize(), SliceUpIllegalIntegerPHI(), unpackLoadToAggregate(), visitAllocaInst(), visitLoadInst(), and visitPHINode().
| bool InstCombiner::run | ( | ) |
Run the combiner over the entire worklist until it is empty.
Definition at line 2672 of file InstructionCombining.cpp.
References llvm::ConstantFoldInstruction(), llvm::dbgs(), DEBUG, llvm::DL, llvm::Instruction::getDebugLoc(), llvm::BasicBlock::getFirstInsertionPt(), llvm::PHINode::getIncomingBlock(), llvm::BasicBlock::getInstList(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Value::hasOneUse(), I, llvm::iplist< NodeTy, Traits >::insert(), llvm::isInstructionTriviallyDead(), llvm::User::operands(), llvm::Value::print(), llvm::Value::replaceAllUsesWith(), SI, llvm::SS, llvm::succ_begin(), llvm::succ_end(), TryToSinkInstruction(), llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::Value::user_begin().
Referenced by combineInstructionsOverFunction().
| bool InstCombiner::SimplifyDivRemOfSelect | ( | BinaryOperator & | I | ) |
SimplifyDivRemOfSelect - Try to fold a divide or remainder of a select instruction.
Definition at line 710 of file InstCombineMulDivRem.cpp.
References llvm::BasicBlock::begin(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Value::hasOneUse(), I, llvm::User::setOperand(), SI, llvm::AArch64DB::ST, and llvm::Value::use_empty().
Try to fold a signed range checked with lower bound 0 to an unsigned icmp.
Example: (icmp sge x, 0) & (icmp slt x, n) –> icmp ult x, n If Inverted is true then the check is for the inverted range, e.g. (icmp slt x, 0) | (icmp sgt x, n) –> icmp ugt x, n
Definition at line 830 of file InstCombineAndOrXor.cpp.
References llvm::ComputeSignBit(), llvm::dyn_cast(), llvm::CmpInst::getInversePredicate(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::CmpInst::getSwappedPredicate(), llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm::ConstantInt::isMinusOne(), and llvm::ConstantInt::isZero().
| Instruction * InstCombiner::SliceUpIllegalIntegerPHI | ( | PHINode & | FirstPhi | ) |
This is an integer PHI and we know that it has an illegal type: see if it is only used by trunc or trunc(lshr) operations.
If so, we split the PHI into the various pieces being extracted. This sort of thing is introduced when SROA promotes an aggregate to large integer values.
TODO: The user of the trunc may be an bitcast to float/double/vector or an inttoptr. We should produce new PHIs in the right type.
Definition at line 614 of file InstCombinePHI.cpp.
References llvm::PHINode::addIncoming(), llvm::array_pod_sort(), llvm::SmallVectorTemplateCommon< T >::begin(), Builder, llvm::SmallPtrSetImpl< PtrType >::count(), llvm::PHINode::Create(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateLShr(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateTrunc(), llvm::dbgs(), DEBUG, llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::ConstantInt::get(), llvm::UndefValue::get(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::Value::getName(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), ReplaceInstUsesWith(), llvm::IRBuilderBase::SetInsertPoint(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::RegState::Undef, llvm::Instruction::user_back(), and llvm::Value::users().
Referenced by visitPHINode().
| Instruction * InstCombiner::visitAdd | ( | BinaryOperator & | I | ) |
Definition at line 1050 of file InstCombineAddSub.cpp.
References llvm::ARM_PROC::A, llvm::AddOne(), checkForNegativeOperand(), llvm::computeKnownBits(), llvm::computeOverflowForUnsignedAdd(), llvm::SelectInst::Create(), CreateAdd(), llvm::BinaryOperator::CreateNeg(), llvm::DL, llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::ConstantExpr::getAdd(), llvm::IntegerType::getBitWidth(), llvm::SelectInst::getCondition(), llvm::SelectInst::getFalseValue(), llvm::APInt::getHighBitsSet(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::ConstantExpr::getSExt(), llvm::SelectInst::getTrueValue(), llvm::ConstantExpr::getTrunc(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::ConstantExpr::getXor(), llvm::BinaryOperator::hasNoSignedWrap(), llvm::BinaryOperator::hasNoUnsignedWrap(), llvm::Value::hasOneUse(), llvm::haveNoCommonBitsSet(), I, llvm::Type::isIntegerTy(), llvm::APInt::isPowerOf2(), llvm::APInt::isSignBit(), IT(), llvm::APInt::logBase2(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Sub(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::PatternMatch::m_Zero(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), N, llvm::NeverOverflows, llvm::AArch64CC::NV, llvm::BinaryOperator::setHasNoSignedWrap(), llvm::BinaryOperator::setHasNoUnsignedWrap(), SI, llvm::SimplifyAddInst(), llvm::SubOne(), and X.
| Instruction * InstCombiner::visitAddrSpaceCast | ( | AddrSpaceCastInst & | CI | ) |
Definition at line 1880 of file InstCombineCasts.cpp.
References llvm::VectorType::get(), llvm::PointerType::get(), llvm::PointerType::getAddressSpace(), llvm::SequentialType::getElementType(), llvm::User::getOperand(), llvm::Type::getScalarType(), and llvm::Value::getType().
| Instruction * InstCombiner::visitAllocaInst | ( | AllocaInst & | AI | ) |
Definition at line 223 of file InstCombineLoadStoreAlloca.cpp.
References llvm::dbgs(), DEBUG, llvm::dyn_cast(), EraseInstFromFunction(), llvm::ConstantInt::get(), llvm::AllocaInst::getAlignment(), llvm::AllocaInst::getAllocatedType(), llvm::AllocaInst::getArraySize(), llvm::Function::getEntryBlock(), llvm::BasicBlock::getFirstNonPHIOrDbg(), llvm::getOrEnforceKnownAlignment(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(), llvm::DataLayout::getPrefTypeAlignment(), llvm::AllocaInst::getType(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), I, llvm::AllocaInst::isArrayAllocation(), isOnlyCopiedFromConstantGlobal(), llvm::Type::isSized(), llvm::Instruction::moveBefore(), ReplaceInstUsesWith(), llvm::AllocaInst::setAlignment(), llvm::User::setOperand(), simplifyAllocaArraySize(), llvm::SmallVectorTemplateCommon< T >::size(), and visitAllocSite().
| Instruction * InstCombiner::visitAllocSite | ( | Instruction & | FI | ) |
Definition at line 1906 of file InstructionCombining.cpp.
References llvm::InvokeInst::Create(), F(), llvm::ConstantInt::get(), llvm::UndefValue::get(), llvm::Value::getContext(), llvm::Intrinsic::getDeclaration(), llvm::Type::getInt1Ty(), llvm::Value::getType(), isAllocSiteRemovable(), llvm::ConstantInt::isZero(), llvm::None, llvm::SmallVectorTemplateCommon< T >::size(), and Users.
Referenced by visitAllocaInst().
| Instruction * InstCombiner::visitAnd | ( | BinaryOperator & | I | ) |
Definition at line 1206 of file InstCombineAndOrXor.cpp.
References llvm::ARM_PROC::A, llvm::APInt::countLeadingZeros(), llvm::BinaryOperator::Create(), llvm::CastInst::Create(), llvm::SelectInst::Create(), llvm::BinaryOperator::CreateNot(), llvm::DL, llvm::dyn_cast(), dyn_castNotVal(), llvm::ConstantExpr::getAnd(), llvm::APInt::getBitWidth(), llvm::APInt::getLowBitsSet(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::Type::getScalarType(), llvm::ConstantExpr::getTrunc(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::Value::hasOneUse(), I, llvm::Type::isIntegerTy(), llvm::Type::isIntOrIntVectorTy(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::PatternMatch::m_Zero(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::AArch64CC::NV, llvm::APIntOps::Or(), SI, llvm::SimplifyAndInst(), std::swap(), X, llvm::APIntOps::Xor(), and Y.
| Instruction * InstCombiner::visitAShr | ( | BinaryOperator & | I | ) |
Definition at line 781 of file InstCombineShifts.cpp.
References llvm::DL, llvm::APInt::getLowBitsSet(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::APInt::getSignBit(), llvm::Value::getType(), I, llvm::BinaryOperator::isExact(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::BinaryOperator::setIsExact(), llvm::SimplifyAShrInst(), and X.
| Instruction * InstCombiner::visitBitCast | ( | BitCastInst & | CI | ) |
Definition at line 1754 of file InstCombineCasts.cpp.
References llvm::CastInst::Create(), llvm::InsertElementInst::Create(), llvm::GetElementPtrInst::CreateInBounds(), llvm::DL, llvm::UndefValue::get(), llvm::Value::getContext(), llvm::SequentialType::getElementType(), llvm::Type::getInt32Ty(), llvm::Constant::getNullValue(), llvm::Type::getNumContainedTypes(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), llvm::Type::isDoubleTy(), llvm::Type::isFloatTy(), llvm::Type::isPointerTy(), llvm::Type::isVectorTy(), OptimizeIntegerToVectorInsertions(), OptimizeIntToFloatBitCast(), and OptimizeVectorResize().
| Instruction * InstCombiner::visitBranchInst | ( | BranchInst & | BI | ) |
Definition at line 2051 of file InstructionCombining.cpp.
References llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_ONE, llvm::UndefValue::get(), llvm::BranchInst::getCondition(), llvm::CmpInst::getInversePredicate(), llvm::BranchInst::getSuccessor(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_ULE, llvm::BranchInst::isConditional(), llvm::PatternMatch::m_Br(), llvm::PatternMatch::m_FCmp(), llvm::PatternMatch::m_ICmp(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::BranchInst::setCondition(), llvm::CmpInst::setPredicate(), llvm::BranchInst::swapSuccessors(), X, and Y.
| Instruction * InstCombiner::visitCallInst | ( | CallInst & | CI | ) |
visitCallInst - CallInst simplification.
This mostly only handles folding of intrinsic instructions. For normal calls, it allows visitCallSite to do the heavy lifting.
Definition at line 326 of file InstCombineCalls.cpp.
References llvm::ARM_PROC::A, llvm::CallInst::arg_operands(), llvm::computeKnownBits(), llvm::CastInst::Create(), llvm::SelectInst::Create(), llvm::CastInst::CreateIntegerCast(), llvm::APFloat::divide(), llvm::DL, llvm::Function::doesNotThrow(), llvm::CallInst::doesNotThrow(), llvm::dyn_cast(), F(), llvm::ConstantInt::get(), llvm::ConstantFP::get(), llvm::ConstantAggregateZero::get(), llvm::VectorType::get(), llvm::ConstantVector::get(), llvm::ConstantPointerNull::get(), llvm::ConstantDataVector::get(), llvm::MDNode::get(), llvm::UndefValue::get(), llvm::Constant::getAggregateElement(), llvm::CallInst::getArgOperand(), llvm::APInt::getBitsSet(), llvm::IntegerType::getBitWidth(), llvm::CallInst::getCalledValue(), llvm::Value::getContext(), llvm::Intrinsic::getDeclaration(), llvm::GCRelocateOperands::getDerivedPtr(), llvm::APInt::getHighBitsSet(), llvm::Type::getInt32Ty(), llvm::ConstantExpr::getIntegerCast(), llvm::IntrinsicInst::getIntrinsicID(), llvm::getKnownAlignment(), llvm::APInt::getLowBitsSet(), llvm::ConstantExpr::getMul(), llvm::getObjectSize(), llvm::getOrEnforceKnownAlignment(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::Type::getPrimitiveSizeInBits(), llvm::APFloat::getSemantics(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::PointerType::getUnqual(), llvm::ConstantInt::getZExtValue(), I, llvm::CmpInst::ICMP_NE, llvm::IntrinsicIDToOverflowCheckFlavor(), llvm::APInt::isAllOnesValue(), llvm::isDereferenceablePointer(), llvm::isFreeCall(), llvm::isKnownNonNull(), llvm::Type::isPointerTy(), llvm::isValidAssumeForContext(), IT(), llvm::SPII::Load, llvm::PatternMatch::m_And(), llvm::PatternMatch::m_BSwap(), llvm::PatternMatch::m_FMax(), llvm::PatternMatch::m_FMin(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::makeArrayRef(), llvm::PatternMatch::match(), llvm::maxnum(), llvm::LLVMContext::MD_nonnull, llvm::minnum(), llvm::None, llvm::Attribute::NonNull, llvm::OCF_INVALID, Operands, llvm::APFloat::opOK, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::AttributeSet::ReturnIndex, llvm::APFloat::rmNearestTiesToEven, llvm::CallInst::setArgOperand(), llvm::CallInst::setCalledFunction(), llvm::CallInst::setDoesNotThrow(), llvm::Instruction::setMetadata(), llvm::SimplifyCall(), SimplifyX86insertps(), SimplifyX86vperm2(), llvm::Sched::Source, llvm::SS, std::swap(), llvm::RegState::Undef, llvm::NVPTX::PTXLdStInstCode::V2, X, and Y.
| Instruction * InstCombiner::visitExtractElementInst | ( | ExtractElementInst & | EI | ) |
Definition at line 132 of file InstCombineVectorOps.cpp.
References CheapToScalarize(), llvm::BinaryOperator::Create(), llvm::CastInst::Create(), llvm::SelectInst::Create(), llvm::ExtractElementInst::Create(), llvm::DL, llvm::findScalarElement(), llvm::ConstantInt::get(), llvm::UndefValue::get(), llvm::Value::getContext(), llvm::ExtractElementInst::getIndexOperand(), llvm::Type::getInt32Ty(), llvm::Value::getName(), llvm::VectorType::getNumElements(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), llvm::ExtractElementInst::getVectorOperand(), llvm::ExtractElementInst::getVectorOperandType(), llvm::Value::hasOneUse(), I, llvm::ARM_PROC::IE, llvm::Type::isVectorTy(), llvm::APInt::setBit(), llvm::User::setOperand(), SI, and llvm::SimplifyExtractElementInst().
| Instruction * InstCombiner::visitExtractValueInst | ( | ExtractValueInst & | EV | ) |
Definition at line 2171 of file InstructionCombining.cpp.
References llvm::ExtractValueInst::Create(), llvm::InsertValueInst::Create(), CreateAdd(), CreateMul(), llvm::DL, GEP, llvm::UndefValue::get(), llvm::ExtractValueInst::getAggregateOperand(), llvm::ExtractValueInst::getIndices(), llvm::ConstantExpr::getNot(), llvm::ExtractValueInst::hasIndices(), I, llvm::CmpInst::ICMP_UGT, llvm::ExtractValueInst::idx_begin(), llvm::ExtractValueInst::idx_end(), llvm::makeArrayRef(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), and llvm::SimplifyExtractValueInst().
| Instruction * InstCombiner::visitFAdd | ( | BinaryOperator & | I | ) |
Definition at line 1315 of file InstCombineAddSub.cpp.
References llvm::ARM_PROC::A, llvm::Instruction::copyFastMathFlags(), llvm::SelectInst::Create(), llvm::DL, llvm::dyn_cast(), llvm::Instruction::getFastMathFlags(), llvm::ConstantExpr::getFPToSI(), llvm::User::getOperand(), llvm::ConstantExpr::getSIToFP(), llvm::Value::getType(), llvm::Instruction::hasNoSignedZeros(), llvm::Instruction::hasUnsafeAlgebra(), I, llvm::Constant::isNegativeZeroValue(), llvm::PatternMatch::m_AnyZero(), llvm::PatternMatch::m_Select(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::AArch64CC::NV, SI, and llvm::SimplifyFAddInst().
| Instruction * InstCombiner::visitFCmpInst | ( | FCmpInst & | I | ) |
Orders the operands of the compare so that they are listed from most complex to least complex. This puts constants before unary operators, before binary operators.
Definition at line 3917 of file InstCombineCompares.cpp.
References llvm::Call, llvm::APFloat::clearSign(), llvm::APFloat::cmpLessThan, llvm::APFloat::compare(), llvm::APFloat::convert(), llvm::DL, llvm::dyn_cast(), F(), llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OGT, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_OLT, llvm::CmpInst::FCMP_ONE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_UEQ, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, GEP, llvm::ConstantFP::get(), llvm::CallInst::getArgOperand(), llvm::CallInst::getCalledFunction(), llvm::getComplexity(), llvm::Instruction::getFastMathFlags(), llvm::ConstantExpr::getFNeg(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::CmpInst::getPredicate(), llvm::APFloat::getSmallestNormalized(), llvm::CastInst::getSrcTy(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::Value::hasOneUse(), I, llvm::APFloat::IEEEdouble, llvm::APFloat::IEEEhalf, llvm::APFloat::IEEEquad, llvm::APFloat::IEEEsingle, llvm::Type::isDoubleTy(), llvm::Type::isFloatTy(), llvm::Type::isFP128Ty(), llvm::Type::isHalfTy(), llvm::Type::isPPC_FP128Ty(), isVolatile(), llvm::Type::isX86_FP80Ty(), llvm::APFloat::isZero(), llvm_unreachable, llvm::SPII::Load, llvm::PatternMatch::m_FNeg(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::AArch64CC::NV, llvm::TargetOpcode::PHI, llvm::APFloat::PPCDoubleDouble, llvm::APFloat::rmNearestTiesToEven, llvm::User::setOperand(), llvm::CmpInst::setPredicate(), SI, llvm::SimplifyFCmpInst(), llvm::FCmpInst::swapOperands(), llvm::Value::user_begin(), X, llvm::APFloat::x87DoubleExtended, and Y.
| Instruction * InstCombiner::visitFDiv | ( | BinaryOperator & | I | ) |
Definition at line 1207 of file InstCombineMulDivRem.cpp.
References CvtFDivConstToReciprocal(), llvm::DL, llvm::Instruction::getDebugLoc(), llvm::Instruction::getFastMathFlags(), llvm::ConstantExpr::getFDiv(), llvm::ConstantExpr::getFMul(), llvm::User::getOperand(), llvm::Instruction::hasAllowReciprocal(), llvm::Value::hasOneUse(), llvm::Instruction::hasUnsafeAlgebra(), isNormalFp(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_FDiv(), llvm::PatternMatch::m_FMul(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::Instruction::setFastMathFlags(), SI, llvm::SimplifyFDivInst(), T, X, and Y.
| Instruction * InstCombiner::visitFMul | ( | BinaryOperator & | I | ) |
Definition at line 527 of file InstCombineMulDivRem.cpp.
References llvm::Instruction::copyFastMathFlags(), detectLog2OfHalf(), llvm::DL, llvm::dyn_cast(), llvm::Instruction::getFastMathFlags(), llvm::ConstantExpr::getFMul(), llvm::ConstantFP::getNegativeZero(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Instruction::hasNoSignedZeros(), llvm::Value::hasOneUse(), llvm::Instruction::hasUnsafeAlgebra(), isFiniteNonZeroFp(), isFMulOrFDivWithConstant(), llvm::BinaryOperator::isFNeg(), isNormalFp(), llvm::Log2(), llvm::PatternMatch::m_FMul(), llvm::PatternMatch::m_SpecificFP(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::AArch64CC::NV, llvm::CallInst::setArgOperand(), SI, llvm::SimplifyFMulInst(), std::swap(), llvm::Value::takeName(), and Y.
| Instruction * InstCombiner::visitFPExt | ( | CastInst & | CI | ) |
Definition at line 1343 of file InstCombineCasts.cpp.
| Instruction * InstCombiner::visitFPToSI | ( | FPToSIInst & | FI | ) |
Definition at line 1402 of file InstCombineCasts.cpp.
References llvm::dyn_cast(), llvm::User::getOperand(), and I.
| Instruction * InstCombiner::visitFPToUI | ( | FPToUIInst & | FI | ) |
Definition at line 1391 of file InstCombineCasts.cpp.
References llvm::dyn_cast(), llvm::User::getOperand(), and I.
| Instruction * InstCombiner::visitFPTrunc | ( | FPTruncInst & | CI | ) |
Definition at line 1192 of file InstCombineCasts.cpp.
References llvm::Instruction::copyFastMathFlags(), llvm::BinaryOperator::Create(), llvm::CallInst::Create(), llvm::SelectInst::Create(), llvm::BinaryOperator::CreateFNeg(), llvm::CastInst::CreateFPCast(), llvm::dyn_cast(), llvm::CallInst::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::Type::getFPMantissaWidth(), llvm::IntrinsicInst::getIntrinsicID(), llvm::Value::getName(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::GlobalValue::getParent(), llvm::Value::getType(), llvm::Value::hasOneUse(), I, llvm::BinaryOperator::isFNeg(), LookThroughFPExtensions(), and SI.
| Instruction * InstCombiner::visitFree | ( | CallInst & | FI | ) |
Definition at line 2002 of file InstructionCombining.cpp.
References llvm::UndefValue::get(), llvm::CallInst::getArgOperand(), llvm::Value::getContext(), llvm::Type::getInt1PtrTy(), llvm::ConstantInt::getTrue(), I, and tryToMoveFreeBeforeNullTest().
| Instruction * InstCombiner::visitFRem | ( | BinaryOperator & | I | ) |
Definition at line 1483 of file InstCombineMulDivRem.cpp.
References llvm::DL, llvm::Instruction::getFastMathFlags(), llvm::User::getOperand(), I, and llvm::SimplifyFRemInst().
| Instruction * InstCombiner::visitFSub | ( | BinaryOperator & | I | ) |
Definition at line 1719 of file InstCombineAddSub.cpp.
References llvm::Instruction::copyFastMathFlags(), llvm::BinaryOperator::CreateFNeg(), llvm::DL, llvm::Instruction::getFastMathFlags(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Instruction::hasUnsafeAlgebra(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::match(), llvm::FastMathFlags::noSignedZeros(), llvm::AArch64CC::NV, SI, and llvm::SimplifyFSubInst().
| Instruction * InstCombiner::visitGetElementPtrInst | ( | GetElementPtrInst & | GEP | ) |
See if we can simplify: X = bitcast A* to B* Y = gep X, <...constant indices...> into a gep of the original struct. This is important for SROA and alias analysis of unions. If "A" is also a bitcast, wait for A/X to be merged.
Definition at line 1315 of file InstructionCombining.cpp.
References llvm::GetElementPtrInst::accumulateConstantOffset(), llvm::PHINode::addIncoming(), llvm::SmallVectorImpl< T >::append(), llvm::CallingConv::C, llvm::Instruction::clone(), llvm::CastInst::Create(), llvm::GetElementPtrInst::Create(), llvm::GetElementPtrInst::CreateInBounds(), llvm::CastInst::CreatePointerBitCastOrAddrSpaceCast(), llvm::DI, llvm::DL, llvm::dyn_cast(), llvm::SmallVectorBase::empty(), F(), GEP, llvm::gep_type_begin(), llvm::gep_type_end(), llvm::PointerType::getAddressSpace(), llvm::GetElementPtrInst::getAddressSpace(), llvm::Type::getArrayElementType(), llvm::SequentialType::getElementType(), llvm::BasicBlock::getFirstInsertionPt(), llvm::PHINode::getIncomingBlock(), llvm::BasicBlock::getInstList(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::GetElementPtrInst::getNumIndices(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Type::getPointerAddressSpace(), llvm::GetElementPtrInst::getPointerAddressSpace(), llvm::Type::getPointerElementType(), llvm::GetElementPtrInst::getPointerOperandType(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::APInt::getSExtValue(), llvm::Value::getType(), llvm::GetElementPtrInst::getType(), I, llvm::GetElementPtrInst::idx_begin(), llvm::GetElementPtrInst::idx_end(), llvm::iplist< NodeTy, Traits >::insert(), llvm::isAllocationFn(), llvm::Type::isArrayTy(), llvm::GetElementPtrInst::isInBounds(), llvm::Type::isSized(), llvm::Type::isStructTy(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_PtrToInt(), llvm::PatternMatch::m_SDiv(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Sub(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::User::op_begin(), llvm::User::op_end(), llvm::User::operands(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::User::setOperand(), llvm::GetElementPtrInst::setSourceElementType(), shouldMergeGEPs(), llvm::SimplifyGEPInst(), llvm::Value::stripPointerCasts(), llvm::Value::takeName(), and Y.
| Instruction * InstCombiner::visitICmpInst | ( | ICmpInst & | I | ) |
Orders the operands of the compare so that they are listed from most complex to least complex. This puts constants before unary operators, before binary operators.
Definition at line 2631 of file InstCombineCompares.cpp.
References llvm::ARM_PROC::A, llvm::APInt::abs(), llvm::APIntOps::And(), ComputeSignedMinMaxValuesFromKnownBits(), ComputeUnsignedMinMaxValuesFromKnownBits(), llvm::APInt::countTrailingZeros(), llvm::CmpInst::Create(), llvm::SelectInst::Create(), llvm::ExtractValueInst::Create(), llvm::BinaryOperator::CreateNot(), DemandedBitsLHSMask(), llvm::DL, llvm::dyn_cast(), GEP, llvm::ConstantInt::get(), llvm::Constant::getAllOnesValue(), llvm::APInt::getAllOnesValue(), llvm::ConstantExpr::getBitCast(), getBitWidth(), llvm::ConstantInt::getBitWidth(), llvm::APInt::getBitWidth(), llvm::getComplexity(), llvm::Value::getContext(), llvm::ConstantInt::getFalse(), llvm::ConstantExpr::getICmp(), llvm::CmpInst::getInversePredicate(), llvm::ConstantInt::getLimitedValue(), llvm::APInt::getLowBitsSet(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), llvm::ConstantExpr::getNot(), llvm::Constant::getNullValue(), llvm::APInt::getOneBitSet(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::User::getOperandUse(), llvm::Instruction::getParent(), llvm::CmpInst::getPredicate(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::ICmpInst::getSignedPredicate(), llvm::CmpInst::getSwappedPredicate(), llvm::ConstantInt::getTrue(), llvm::ConstantInt::getType(), llvm::Value::getType(), llvm::ICmpInst::getUnsignedPredicate(), llvm::ConstantInt::getValue(), llvm::BinaryOperator::hasNoSignedWrap(), llvm::BinaryOperator::hasNoUnsignedWrap(), llvm::Value::hasOneUse(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm::ICmpInst::isEquality(), llvm::BinaryOperator::isExact(), llvm::Type::isIntegerTy(), llvm::Type::isIntOrIntVectorTy(), llvm::isKnownToBeAPowerOfTwo(), llvm::APInt::isNegative(), llvm::Type::isPointerTy(), llvm::APInt::isPowerOf2(), isSignBitCheck(), llvm::CmpInst::isSigned(), llvm::CmpInst::isUnsigned(), isVolatile(), llvm::ConstantInt::isZero(), llvm_unreachable, llvm::SPII::Load, llvm::APInt::logBase2(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Instruction(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Mul(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_NSWSub(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Power2(), llvm::PatternMatch::m_Select(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Sub(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_UAddWithOverflow(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::m_ZExt(), llvm::PatternMatch::match(), NC, llvm::APIntOps::Not(), llvm::AArch64CC::NV, llvm::OCF_UNSIGNED_ADD, llvm::TargetOpcode::PHI, ProcessUGT_ADDCST_ADD(), ProcessUMulZExtIdiom(), llvm::MCID::Select, llvm::User::setOperand(), SI, llvm::SimplifyICmpInst(), llvm::APInt::sle(), llvm::APInt::slt(), std::swap(), swapMayExposeCSEOpportunities(), llvm::ICmpInst::swapOperands(), llvm::APInt::uge(), llvm::APInt::ule(), llvm::APInt::ult(), llvm::Value::user_begin(), X, llvm::APIntOps::Xor(), Y, and llvm::APInt::zext().
| Instruction * InstCombiner::visitICmpInstWithCastAndCast | ( | ICmpInst & | ICI | ) |
visitICmpInstWithCastAndCast - Handle icmp (cast x to y), (cast/cst).
We only handle extending casts so far.
Definition at line 1913 of file InstCombineCompares.cpp.
References llvm::BinaryOperator::CreateNot(), llvm::DL, llvm::dyn_cast(), llvm::Constant::getAllOnesValue(), llvm::ConstantExpr::getCast(), llvm::Type::getIntegerBitWidth(), llvm::ConstantExpr::getIntToPtr(), llvm::Value::getName(), llvm::CastInst::getOpcode(), llvm::User::getOperand(), llvm::Type::getPointerAddressSpace(), llvm::CmpInst::getPredicate(), llvm::ConstantExpr::getTrunc(), llvm::Value::getType(), llvm::ICmpInst::getUnsignedPredicate(), llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::ICmpInst::isEquality(), and llvm::CmpInst::isSigned().
| Instruction * InstCombiner::visitICmpInstWithInstAndIntCst | ( | ICmpInst & | ICI, |
| Instruction * | LHS, | ||
| ConstantInt * | RHS | ||
| ) |
visitICmpInstWithInstAndIntCst - Handle "icmp (instr, intcst)".
Definition at line 1141 of file InstCombineCompares.cpp.
References llvm::AddOne(), llvm::APIntOps::And(), llvm::APInt::byteSwap(), llvm::computeKnownBits(), llvm::APInt::countTrailingZeros(), llvm::dyn_cast(), GEP, llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::ConstantExpr::get(), llvm::APInt::getActiveBits(), llvm::ConstantExpr::getAnd(), llvm::ConstantExpr::getAShr(), llvm::IntegerType::getBitWidth(), getBitWidth(), llvm::ConstantInt::getBitWidth(), llvm::APInt::getBitWidth(), llvm::Value::getContext(), llvm::APInt::getHighBitsSet(), llvm::ConstantInt::getLimitedValue(), llvm::APInt::getLowBitsSet(), llvm::ConstantRange::getLower(), llvm::ConstantExpr::getLShr(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), llvm::ConstantExpr::getNot(), llvm::Constant::getNullValue(), llvm::ConstantExpr::getNUWShl(), llvm::APInt::getOneBitSet(), llvm::Instruction::getOpcode(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::ConstantExpr::getOr(), llvm::CmpInst::getPredicate(), llvm::Type::getPrimitiveSizeInBits(), llvm::ConstantExpr::getShl(), llvm::ICmpInst::getSignedPredicate(), llvm::ConstantExpr::getSub(), llvm::CmpInst::getSwappedPredicate(), llvm::ConstantExpr::getTrunc(), llvm::ConstantInt::getType(), llvm::Value::getType(), llvm::ICmpInst::getUnsignedPredicate(), llvm::ConstantRange::getUpper(), llvm::ConstantInt::getValue(), llvm::ConstantExpr::getXor(), llvm::ConstantExpr::getZExt(), llvm::ConstantInt::getZExtValue(), llvm::Value::hasOneUse(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLE, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULE, llvm::CmpInst::ICMP_ULT, llvm::APInt::isAllOnesValue(), llvm::Instruction::isArithmeticShift(), llvm::ICmpInst::isEquality(), llvm::BinaryOperator::isExact(), isHighOnes(), llvm::APInt::isMinValue(), llvm::ConstantInt::isNegative(), llvm::APInt::isNonNegative(), llvm::Constant::isNullValue(), llvm::APInt::isPowerOf2(), llvm::Instruction::isShift(), llvm::APInt::isSignBit(), isSignBitCheck(), llvm::CmpInst::isSigned(), isSignTest(), llvm::CmpInst::isUnsigned(), llvm::ConstantInt::isZero(), llvm::APInt::logBase2(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_PtrToInt(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::ICmpInst::makeConstantRange(), llvm::PatternMatch::match(), One, llvm::APIntOps::Or(), P, pred, llvm::User::setOperand(), llvm::APInt::sgt(), llvm::SubOne(), llvm::Value::takeName(), llvm::ConstantInt::uge(), X, llvm::APIntOps::Xor(), Y, and llvm::APInt::zext().
| Instruction * InstCombiner::visitInsertElementInst | ( | InsertElementInst & | IE | ) |
Definition at line 480 of file InstCombineVectorOps.cpp.
References CollectShuffleElements(), llvm::ConstantVector::get(), llvm::UndefValue::get(), llvm::APInt::getAllOnesValue(), llvm::VectorType::getNumElements(), llvm::User::getOperand(), llvm::Value::getType(), llvm::InsertElementInst::getType(), llvm::Type::getVectorNumElements(), llvm::Value::hasOneUse(), llvm::ARM_PROC::IE, and llvm::Instruction::user_back().
| Instruction * InstCombiner::visitInsertValueInst | ( | InsertValueInst & | I | ) |
Try to find redundant insertvalue instructions, like the following ones: %0 = insertvalue { i8, i32 } undef, i8 x, 0 %1 = insertvalue { i8, i32 } %0, i8 y, 0 Here the second instruction inserts values at the same indices, as the first one, making the first one redundant.
It should be transformed to: %0 = insertvalue { i8, i32 } undef, i8 y, 0
Definition at line 452 of file InstCombineVectorOps.cpp.
References llvm::dyn_cast(), llvm::InsertValueInst::getIndices(), llvm::User::getOperand(), llvm::Value::hasOneUse(), I, and llvm::Value::user_back().
|
inline |
Definition at line 331 of file InstCombineInternal.h.
| Instruction * InstCombiner::visitIntToPtr | ( | IntToPtrInst & | CI | ) |
Definition at line 1421 of file InstCombineCasts.cpp.
References llvm::DL, llvm::VectorType::get(), llvm::IntToPtrInst::getAddressSpace(), llvm::Value::getContext(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), llvm::Type::isVectorTy(), and P.
| Instruction * InstCombiner::visitInvokeInst | ( | InvokeInst & | II | ) |
Definition at line 1259 of file InstCombineCalls.cpp.
| Instruction * InstCombiner::visitLandingPadInst | ( | LandingPadInst & | LI | ) |
Definition at line 2345 of file InstructionCombining.cpp.
References llvm::LandingPadInst::addClause(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::classifyEHPersonality(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::LandingPadInst::Create(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SmallVectorImpl< T >::erase(), llvm::ArrayType::get(), llvm::ConstantArray::get(), llvm::LandingPadInst::getClause(), llvm::SequentialType::getElementType(), llvm::Constant::getNullValue(), llvm::LandingPadInst::getNumClauses(), llvm::ArrayType::getNumElements(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::Function::getPersonalityFn(), llvm::Intrinsic::getType(), llvm::Value::getType(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::LandingPadInst::isCatch(), isCatchAll(), llvm::LandingPadInst::isCleanup(), llvm::LandingPadInst::isFilter(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorImpl< T >::reserve(), llvm::LandingPadInst::setCleanup(), shorter_filter(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::Constant::stripPointerCasts(), and llvm::Value::stripPointerCasts().
| Instruction * InstCombiner::visitLoadInst | ( | LoadInst & | LI | ) |
Definition at line 716 of file InstCombineLoadStoreAlloca.cpp.
References llvm::InstCombineWorklist::Add(), Align(), Builder, combineLoadToOperationType(), llvm::combineMetadata(), llvm::SelectInst::Create(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateBitOrPointerCast(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateLoad(), llvm::FindAvailableLoadedValue(), llvm::UndefValue::get(), llvm::DataLayout::getABITypeAlignment(), llvm::LoadInst::getAlignment(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::getOrEnforceKnownAlignment(), llvm::Instruction::getParent(), llvm::LoadInst::getPointerAddressSpace(), llvm::DataLayout::getPrefTypeAlignment(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::isSafeToLoadUnconditionally(), llvm::LoadInst::isSimple(), llvm::LLVMContext::MD_alias_scope, llvm::LLVMContext::MD_invariant_load, llvm::LLVMContext::MD_noalias, llvm::LLVMContext::MD_nonnull, llvm::LLVMContext::MD_range, llvm::LLVMContext::MD_tbaa, replaceGEPIdxWithZero(), ReplaceInstUsesWith(), llvm::LoadInst::setAlignment(), llvm::User::setOperand(), llvm::SI, unpackLoadToAggregate(), llvm::NVPTX::PTXLdStInstCode::V2, and Worklist.
| Instruction * InstCombiner::visitLShr | ( | BinaryOperator & | I | ) |
Definition at line 737 of file InstCombineShifts.cpp.
References llvm::DL, llvm::APInt::getLowBitsSet(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::ConstantInt::getSigned(), llvm::Value::getType(), I, llvm::BinaryOperator::isExact(), llvm::isPowerOf2_32(), llvm::Log2_32(), llvm::MaskedValueIsZero(), llvm::BinaryOperator::setIsExact(), and llvm::SimplifyLShrInst().
| Instruction * InstCombiner::visitMul | ( | BinaryOperator & | I | ) |
i1 mul -> i1 and.
Definition at line 168 of file InstCombineMulDivRem.cpp.
References llvm::APInt::abs(), llvm::computeOverflowForUnsignedMul(), CreateAdd(), CreateMul(), llvm::BinaryOperator::CreateNeg(), llvm::DL, llvm::dyn_cast(), llvm::ConstantInt::get(), getLogBase2Vector(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarType(), llvm::ConstantExpr::getShl(), llvm::Value::getType(), llvm::BinaryOperator::hasNoSignedWrap(), llvm::BinaryOperator::hasNoUnsignedWrap(), llvm::Value::hasOneUse(), llvm::Type::isIntegerTy(), llvm::APInt::isNegative(), llvm::Constant::isNotMinSignedValue(), llvm::APInt::isPowerOf2(), llvm::Type::isVectorTy(), llvm::APInt::logBase2(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Mul(), llvm::PatternMatch::m_NSWSub(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Sub(), llvm::PatternMatch::m_Value(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::NeverOverflows, llvm::AArch64CC::NV, llvm::BinaryOperator::setHasNoSignedWrap(), llvm::BinaryOperator::setHasNoUnsignedWrap(), SI, llvm::SimplifyMulInst(), llvm::Value::takeName(), X, and Y.
| Instruction * InstCombiner::visitOr | ( | BinaryOperator & | I | ) |
Definition at line 2144 of file InstCombineAndOrXor.cpp.
References llvm::ARM_PROC::A, llvm::CastInst::Create(), llvm::SelectInst::Create(), llvm::BinaryOperator::CreateNot(), llvm::DL, llvm::dyn_cast(), dyn_castNotVal(), llvm::Value::getName(), llvm::CastInst::getOpcode(), llvm::User::getOperand(), llvm::ConstantExpr::getOr(), llvm::ConstantInt::getSigned(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::Value::hasOneUse(), I, llvm::Type::isIntegerTy(), llvm::Type::isIntOrIntVectorTy(), llvm::Type::isVectorTy(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_LogicalShift(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Select(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), MatchSelectFromAndOr(), llvm::APIntOps::Not(), llvm::AArch64CC::NV, llvm::APIntOps::Or(), llvm::MipsISD::Ret, SI, llvm::SimplifyOrInst(), std::swap(), llvm::Value::takeName(), llvm::NVPTX::PTXLdStInstCode::V2, X, llvm::APIntOps::Xor(), and Y.
| Instruction * InstCombiner::visitPHINode | ( | PHINode & | PN | ) |
Definition at line 786 of file InstCombinePHI.cpp.
References llvm::BasicBlock::begin(), DeadPHICycle(), llvm::UndefValue::get(), llvm::PHINode::getBasicBlockIndex(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::Instruction::getParent(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::Type::isIntegerTy(), llvm::DataLayout::isLegalInteger(), PHIsEqualValue(), ReplaceInstUsesWith(), llvm::PHINode::setIncomingBlock(), llvm::PHINode::setIncomingValue(), llvm::SimplifyInstruction(), SliceUpIllegalIntegerPHI(), llvm::Instruction::user_back(), and llvm::VB.
| Instruction * InstCombiner::visitPtrToInt | ( | PtrToIntInst & | CI | ) |
Definition at line 1467 of file InstCombineCasts.cpp.
References llvm::CastInst::CreateIntegerCast(), llvm::DL, llvm::VectorType::get(), llvm::Value::getContext(), llvm::User::getOperand(), llvm::PtrToIntInst::getPointerAddressSpace(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), llvm::Type::isVectorTy(), and P.
| Instruction * InstCombiner::visitReturnInst | ( | ReturnInst & | RI | ) |
Definition at line 2031 of file InstructionCombining.cpp.
References llvm::computeKnownBits(), llvm::Constant::getIntegerValue(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), llvm::Type::isIntegerTy(), and llvm::User::setOperand().
| Instruction * InstCombiner::visitSDiv | ( | BinaryOperator & | I | ) |
Definition at line 1109 of file InstCombineMulDivRem.cpp.
References llvm::BinaryOperator::CreateNeg(), llvm::DL, llvm::ConstantInt::get(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::APInt::getSignBit(), llvm::Value::getType(), llvm::BinaryOperator::isExact(), llvm::Type::isIntegerTy(), llvm::isKnownToBeAPowerOfTwo(), llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_NSWSub(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Zero(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::SimplifySDivInst(), and X.
| Instruction* llvm::InstCombiner::visitSelectInst | ( | SelectInst & | SI | ) |
| Instruction* llvm::InstCombiner::visitSelectInstWithICmp | ( | SelectInst & | SI, |
| ICmpInst * | ICI | ||
| ) |
| Instruction * InstCombiner::visitSExt | ( | SExtInst & | CI | ) |
Definition at line 1053 of file InstCombineCasts.cpp.
References llvm::ARM_PROC::A, CanEvaluateSExtd(), llvm::ComputeNumSignBits(), llvm::ComputeSignBit(), llvm::dbgs(), DEBUG, llvm::ConstantInt::get(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and llvm::Instruction::user_back().
| Instruction * InstCombiner::visitShl | ( | BinaryOperator & | I | ) |
Definition at line 695 of file InstCombineShifts.cpp.
References llvm::ARM_PROC::A, llvm::ComputeNumSignBits(), llvm::DL, llvm::APInt::getHighBitsSet(), llvm::User::getOperand(), llvm::ConstantExpr::getShl(), llvm::BinaryOperator::hasNoSignedWrap(), llvm::BinaryOperator::hasNoUnsignedWrap(), I, llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Value(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::BinaryOperator::setHasNoSignedWrap(), llvm::BinaryOperator::setHasNoUnsignedWrap(), and llvm::SimplifyShlInst().
| Instruction * InstCombiner::visitShuffleVectorInst | ( | ShuffleVectorInst & | SVI | ) |
Definition at line 830 of file InstCombineVectorOps.cpp.
References CanEvaluateShuffled(), llvm::DL, llvm::dyn_cast(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::MipsISD::Ext, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), llvm::SmallVectorTemplateCommon< T >::front(), llvm::ConstantInt::get(), llvm::VectorType::get(), llvm::ConstantVector::get(), llvm::UndefValue::get(), llvm::APInt::getAllOnesValue(), llvm::VectorType::getBitWidth(), llvm::Value::getContext(), llvm::SequentialType::getElementType(), llvm::Type::getInt32Ty(), llvm::Value::getName(), llvm::VectorType::getNumElements(), llvm::User::getOperand(), llvm::ShuffleVectorInst::getShuffleMask(), llvm::Value::getType(), llvm::ShuffleVectorInst::getType(), I, isShuffleExtractingFromLHS(), llvm::VectorType::isValidElementType(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), RecognizeIdentityMask(), llvm::User::setOperand(), llvm::SmallVectorTemplateCommon< T >::size(), and llvm::Value::users().
| Instruction * InstCombiner::visitSIToFP | ( | CastInst & | CI | ) |
Definition at line 1417 of file InstCombineCasts.cpp.
| Instruction * InstCombiner::visitSRem | ( | BinaryOperator & | I | ) |
Definition at line 1408 of file InstCombineMulDivRem.cpp.
References llvm::DL, llvm::ConstantInt::get(), llvm::ConstantVector::get(), llvm::Constant::getAggregateElement(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::APInt::getSignBit(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), I, llvm::Type::isIntegerTy(), llvm::APInt::isMinSignedValue(), llvm::APInt::isNegative(), llvm::PatternMatch::m_APInt(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::User::setOperand(), llvm::SimplifySRemInst(), and Y.
| Instruction * InstCombiner::visitStoreInst | ( | StoreInst & | SI | ) |
Definition at line 944 of file InstCombineLoadStoreAlloca.cpp.
References llvm::InstCombineWorklist::Add(), llvm::BasicBlock::begin(), combineStoreToValueType(), equivalentAddressValues(), EraseInstFromFunction(), GEP, llvm::UndefValue::get(), llvm::DataLayout::getABITypeAlignment(), llvm::StoreInst::getAlignment(), llvm::User::getOperand(), llvm::getOrEnforceKnownAlignment(), llvm::Instruction::getParent(), llvm::StoreInst::getPointerAddressSpace(), llvm::DataLayout::getPrefTypeAlignment(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::StoreInst::isSimple(), replaceGEPIdxWithZero(), llvm::StoreInst::setAlignment(), llvm::User::setOperand(), llvm::SI, unpackStoreToAggregate(), and Worklist.
| Instruction * InstCombiner::visitSub | ( | BinaryOperator & | I | ) |
Definition at line 1493 of file InstCombineAddSub.cpp.
References llvm::ARM_PROC::A, llvm::AddOne(), llvm::computeKnownBits(), llvm::SelectInst::Create(), CreateAdd(), llvm::BinaryOperator::CreateNeg(), llvm::BinaryOperator::CreateNot(), llvm::CastInst::CreateSExtOrBitCast(), llvm::CastInst::CreateZExtOrBitCast(), llvm::DL, llvm::ConstantExpr::getNeg(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::ConstantExpr::getSub(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::BinaryOperator::hasNoSignedWrap(), llvm::BinaryOperator::hasNoUnsignedWrap(), llvm::Value::hasOneUse(), llvm::tgtok::IntVal, llvm::Type::isIntegerTy(), llvm::Constant::isNotMinSignedValue(), llvm::Constant::isOneValue(), llvm::APFloat::isZero(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Mul(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_PtrToInt(), llvm::PatternMatch::m_SDiv(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Sub(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::m_ZExt(), llvm::PatternMatch::match(), llvm::BinaryOperator::setHasNoSignedWrap(), llvm::BinaryOperator::setHasNoUnsignedWrap(), SI, llvm::SimplifySubInst(), X, and Y.
| Instruction * InstCombiner::visitSwitchInst | ( | SwitchInst & | SI | ) |
Definition at line 2108 of file InstructionCombining.cpp.
References llvm::SwitchInst::case_begin(), llvm::SwitchInst::case_end(), llvm::SwitchInst::cases(), llvm::computeKnownBits(), llvm::APInt::countLeadingOnes(), llvm::DL, llvm::IntegerType::get(), llvm::ConstantInt::get(), getBitWidth(), llvm::SwitchInst::getCondition(), llvm::Value::getContext(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::ConstantExpr::getSExt(), llvm::ConstantExpr::getSub(), llvm::Value::getType(), llvm::ConstantExpr::getZExt(), fuzzer::min(), llvm::SwitchInst::setCondition(), and SI.
| Instruction * InstCombiner::visitTrunc | ( | TruncInst & | CI | ) |
Definition at line 434 of file InstCombineCasts.cpp.
References llvm::ARM_PROC::A, CanEvaluateTruncated(), llvm::CastInst::CreateIntegerCast(), llvm::dbgs(), DEBUG, llvm::ConstantInt::get(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::ConstantExpr::getTrunc(), llvm::Value::getType(), llvm::ConstantInt::getZExtValue(), llvm::Value::hasOneUse(), llvm::CmpInst::ICMP_NE, llvm::Type::isVectorTy(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_ZExt(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), One, SI, llvm::SPF_UNKNOWN, and llvm::Value::takeName().
| Instruction * InstCombiner::visitUDiv | ( | BinaryOperator & | I | ) |
Definition at line 1036 of file InstCombineMulDivRem.cpp.
References llvm::SelectInst::Create(), llvm::DL, dyn_castZExtVal(), llvm::ConstantInt::get(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Instruction::insertBefore(), llvm::BinaryOperator::isExact(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Exact(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::BinaryOperator::setIsExact(), llvm::SimplifyUDivInst(), llvm::APInt::ushl_ov(), visitUDivOperand(), and X.
| Instruction * InstCombiner::visitUIToFP | ( | CastInst & | CI | ) |
Definition at line 1413 of file InstCombineCasts.cpp.
| Instruction * InstCombiner::visitURem | ( | BinaryOperator & | I | ) |
Definition at line 1373 of file InstCombineMulDivRem.cpp.
References llvm::DL, dyn_castZExtVal(), llvm::MipsISD::Ext, llvm::Constant::getAllOnesValue(), llvm::User::getOperand(), llvm::Value::getType(), llvm::isKnownToBeAPowerOfTwo(), llvm::PatternMatch::m_One(), llvm::PatternMatch::match(), and llvm::SimplifyURemInst().
| Instruction * InstCombiner::visitXor | ( | BinaryOperator & | I | ) |
Definition at line 2531 of file InstCombineAndOrXor.cpp.
References llvm::ARM_PROC::A, llvm::APIntOps::And(), llvm::CastInst::Create(), llvm::CmpInst::Create(), CreateAdd(), llvm::BinaryOperator::CreateNot(), llvm::DL, llvm::dyn_cast(), dyn_castNotVal(), llvm::ConstantInt::get(), llvm::ConstantExpr::getAnd(), llvm::ConstantExpr::getCast(), llvm::Instruction::getDebugLoc(), llvm::getICmpCode(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), getNewICmpValue(), llvm::ConstantExpr::getNot(), llvm::BinaryOperator::getOpcode(), llvm::CmpInst::getOpcode(), llvm::User::getOperand(), llvm::ConstantExpr::getOr(), llvm::ConstantExpr::getSub(), llvm::ConstantInt::getType(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::Value::hasOneUse(), I, llvm::IsFreeToInvert(), llvm::Type::isIntegerTy(), llvm::APInt::lshr(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::AArch64CC::NV, llvm::APIntOps::Or(), llvm::PredicatesFoldable(), llvm::User::setOperand(), SI, llvm::SimplifyXorInst(), std::swap(), llvm::BinaryOperator::swapOperands(), llvm::Value::takeName(), and llvm::APIntOps::Xor().
| Instruction * InstCombiner::visitZExt | ( | ZExtInst & | CI | ) |
Definition at line 766 of file InstCombineCasts.cpp.
References llvm::ARM_PROC::A, llvm::APIntOps::And(), CanEvaluateZExtd(), llvm::BinaryOperator::Create(), llvm::dbgs(), DEBUG, llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::APInt::getHighBitsSet(), llvm::APInt::getLowBitsSet(), llvm::Value::getName(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::Value::getType(), llvm::ConstantExpr::getZExt(), llvm::Value::hasOneUse(), llvm::Type::isIntegerTy(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::APIntOps::Or(), llvm::Instruction::user_back(), and X.
| BuilderTy* llvm::InstCombiner::Builder |
Definition at line 175 of file InstCombineInternal.h.
Referenced by combineLoadToNewType(), combineLoadToOperationType(), combineStoreToNewValue(), EvaluateGEPOffsetExpression(), FoldOperationIntoSelectOperand(), foldUDivNegCst(), foldUDivShl(), GetShiftedValue(), OptimizeIntegerToVectorInsertions(), OptimizeIntToFloatBitCast(), OptimizeVectorResize(), ProcessUGT_ADDCST_ADD(), ProcessUMulZExtIdiom(), simplifyAllocaArraySize(), simplifyValueKnownNonZero(), SliceUpIllegalIntegerPHI(), unpackLoadToAggregate(), unpackStoreToAggregate(), and visitLoadInst().
| InstCombineWorklist& llvm::InstCombiner::Worklist |
A worklist of the instructions that need to be simplified.
Definition at line 170 of file InstCombineInternal.h.
Referenced by GetShiftedValue(), ProcessUMulZExtIdiom(), visitLoadInst(), and visitStoreInst().
1.8.6