|
LLVM
5.0.0
|
The core instruction combiner logic. More...
#include "Transforms/InstCombine/InstCombineInternal.h"
Public Types | |
| typedef IRBuilder < TargetFolder, IRBuilderCallbackInserter > | 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 |
| uint64_t | MaxArraySizeForCombine |
| Maximum size of array considered when transforming. More... | |
The core instruction combiner logic.
This class provides both the logic to recursively visit instructions and combine them.
Definition at line 203 of file InstCombineInternal.h.
An IRBuilder that automatically inserts new instructions into the worklist.
Definition at line 212 of file InstCombineInternal.h.
|
inline |
Definition at line 236 of file InstCombineInternal.h.
| Instruction * InstCombiner::commonCastTransforms | ( | CastInst & | CI | ) |
Implement the transforms common to all CastInst visitors.
Definition at line 260 of file InstCombineCasts.cpp.
References llvm::CastInst::Create(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Type::isIntegerTy(), 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 851 of file InstCombineMulDivRem.cpp.
References assert(), 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::Instruction::isExact(), llvm::Type::isIntOrIntVectorTy(), IsMultiple(), llvm::APInt::isNullValue(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_NSWMul(), llvm::PatternMatch::m_NSWShl(), llvm::PatternMatch::m_NUWMul(), llvm::PatternMatch::m_NUWShl(), llvm::PatternMatch::m_One(), 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::Instruction::setHasNoSignedWrap(), llvm::Instruction::setHasNoUnsignedWrap(), llvm::Instruction::setIsExact(), llvm::User::setOperand(), simplifyValueKnownNonZero(), X, and llvm::Z.
| 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 1427 of file InstCombineMulDivRem.cpp.
References llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), I, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), llvm::User::setOperand(), SI, and simplifyValueKnownNonZero().
| Instruction * InstCombiner::commonPointerCastTransforms | ( | CastInst & | CI | ) |
Implement the transforms for cast of pointer (bitcast/ptrtoint)
Definition at line 1588 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 A, assert(), B, C, llvm::BinaryOperator::Create(), llvm::DL, llvm::ConstantInt::get(), llvm::Value::getName(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Value::getType(), I, llvm::isKnownNonNegative(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_Power2(), llvm::PatternMatch::m_SRem(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::User::setOperand(), and SI.
|
inline |
Definition at line 541 of file InstCombineInternal.h.
References llvm::computeKnownBits(), and llvm::DL.
Referenced by canReplaceGEPIdxWithZero(), foldCtpop(), and foldCttzCtlz().
|
inline |
Definition at line 545 of file InstCombineInternal.h.
References llvm::computeKnownBits(), and llvm::DL.
|
inline |
Definition at line 560 of file InstCombineInternal.h.
References llvm::ComputeNumSignBits(), llvm::Depth, and llvm::DL.
Referenced by processUGT_ADDCST_ADD().
|
inline |
Definition at line 574 of file InstCombineInternal.h.
References llvm::computeOverflowForSignedAdd(), and llvm::DL.
|
inline |
Definition at line 569 of file InstCombineInternal.h.
References llvm::computeOverflowForUnsignedAdd(), and llvm::DL.
|
inline |
Definition at line 564 of file InstCombineInternal.h.
References llvm::computeOverflowForUnsignedMul(), and llvm::DL.
|
inline |
Creates a result tuple for an overflow intrinsic II with a given Result and a constant Overflow value.
Definition at line 510 of file InstCombineInternal.h.
References llvm::InsertValueInst::Create(), llvm::ConstantStruct::get(), llvm::UndefValue::get(), llvm::Value::getType(), and llvm::ARM_MB::ST.
| bool InstCombiner::dominatesAllUses | ( | const Instruction * | DI, |
| const Instruction * | UI, | ||
| const BasicBlock * | DB | ||
| ) | const |
True when DB dominates all uses of DI except UI.
Check that one use is in the same block as the definition and all other uses are in blocks dominated by a given block.
UI must be in the same block as DI. The routine checks that the DI parent and DB are different.
| 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 4009 of file InstCombineCompares.cpp.
References assert(), 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 523 of file InstCombineInternal.h.
References assert(), llvm::dbgs(), DEBUG, llvm::Instruction::eraseFromParent(), llvm::User::getNumOperands(), llvm::User::operands(), llvm::salvageDebugInfo(), and llvm::Value::use_empty().
Referenced by combineLoadToOperationType(), removeTriviallyEmptyRange(), simplifyMaskedScatter(), simplifyMaskedStore(), simplifyX86MaskedStore(), visitAllocaInst(), and visitStoreInst().
| 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 544 of file InstCombineMulDivRem.cpp.
References assert(), llvm::dyn_cast(), F, llvm::ConstantExpr::getFDiv(), llvm::ConstantExpr::getFMul(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Value::hasOneUse(), isFMulOrFDivWithConstant(), and isNormalFp().
| Instruction * InstCombiner::FoldItoFPtoI | ( | Instruction & | FI | ) |
Definition at line 1496 of file InstCombineCasts.cpp.
References llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), and fuzzer::min().
| Instruction * InstCombiner::FoldShiftByConstant | ( | Value * | Op0, |
| Constant * | Op1, | ||
| BinaryOperator & | I | ||
| ) |
Definition at line 313 of file InstCombineShifts.cpp.
References llvm::MCID::Add, assert(), llvm::tgtok::Bits, canEvaluateShifted(), llvm::BinaryOperator::Create(), llvm::dbgs(), DEBUG, llvm::DL, llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::ConstantExpr::get(), llvm::Value::getContext(), llvm::APInt::getHighBitsSet(), llvm::APInt::getLimitedValue(), llvm::APInt::getLowBitsSet(), llvm::Value::getName(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), getShiftedValue(), llvm::ConstantExpr::getShl(), llvm::ConstantVector::getSplat(), llvm::Value::getType(), llvm::ConstantExpr::getZExt(), llvm::APInt::getZExtValue(), llvm::Value::hasOneUse(), I, llvm::Instruction::isLogicalShift(), llvm::Instruction::isShift(), isValid(), LLVM_FALLTHROUGH, llvm::APInt::lshrInPlace(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Shr(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::BitmaskEnumDetail::Mask(), llvm::PatternMatch::match(), llvm::Value::takeName(), llvm::APInt::uge(), llvm::NVPTX::PTXLdStInstCode::V2, and X.
|
inline |
Definition at line 249 of file InstCombineInternal.h.
Referenced by foldCttzCtlz().
|
inline |
Definition at line 251 of file InstCombineInternal.h.
References llvm::DL.
Referenced by canReplaceGEPIdxWithZero(), combineLoadToNewType(), combineLoadToOperationType(), foldCttzCtlz(), foldVecTruncToExtElt(), likeBitCastFromVector(), optimizeIntegerToVectorInsertions(), simplifyAllocaArraySize(), unpackLoadToAggregate(), and unpackStoreToAggregate().
|
inline |
Definition at line 253 of file InstCombineInternal.h.
Referenced by foldCttzCtlz().
|
inline |
Definition at line 255 of file InstCombineInternal.h.
|
inline |
Definition at line 257 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 468 of file InstCombineInternal.h.
References assert(), llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getParent(), and llvm::iplist_impl< IntrusiveListT, TraitsT >::insert().
Referenced by simplifyAllocaArraySize().
|
inline |
Same as InsertNewInstBefore, but also sets the debug loc.
Definition at line 478 of file InstCombineInternal.h.
References llvm::Instruction::getDebugLoc(), and llvm::Instruction::setDebugLoc().
Referenced by replaceExtractElements().
|
inline |
Definition at line 550 of file InstCombineInternal.h.
References llvm::Depth, llvm::DL, and llvm::isKnownToBeAPowerOfTwo().
Referenced by simplifyValueKnownNonZero().
|
inline |
Definition at line 556 of file InstCombineInternal.h.
References llvm::Depth, llvm::DL, and llvm::MaskedValueIsZero().
Referenced by canEvaluateShiftedShift().
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 1427 of file InstCombineAddSub.cpp.
References llvm::EmitGEPOffset().
| bool InstCombiner::replacedSelectWithOperand | ( | SelectInst * | SI, |
| const ICmpInst * | Icmp, | ||
| const unsigned | SIOpd | ||
| ) |
Try to replace select with select operand SIOpd in SI-ICmp sequence.
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 4084 of file InstCombineCompares.cpp.
References assert(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::CmpInst::getPredicate(), llvm::BasicBlock::getSinglePredecessor(), llvm::TerminatorInst::getSuccessor(), llvm::BasicBlock::getTerminator(), 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, replaceable 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 489 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 foldCttzCtlz(), processUGT_ADDCST_ADD(), processUMulZExtIdiom(), replaceExtractElements(), simplifyAllocaArraySize(), simplifyMaskedGather(), simplifyX86MaskedLoad(), unpackLoadToAggregate(), visitAllocaInst(), and visitLoadInst().
| bool llvm::InstCombiner::replacePointer | ( | Instruction & | I, |
| Value * | V | ||
| ) |
Try to replace instruction I with value V which are pointers in different address space.
| bool InstCombiner::run | ( | ) |
Run the combiner over the entire worklist until it is empty.
Definition at line 2870 of file InstructionCombining.cpp.
References llvm::computeKnownBits(), llvm::ConstantFoldInstruction(), llvm::dbgs(), DEBUG, llvm::DL, E, llvm::ConstantInt::get(), llvm::KnownBits::getConstant(), llvm::Instruction::getDebugLoc(), llvm::BasicBlock::getFirstInsertionPt(), llvm::PHINode::getIncomingBlock(), llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::iplist_impl< IntrusiveListT, TraitsT >::insert(), llvm::KnownBits::isConstant(), llvm::isInstructionTriviallyDead(), llvm::Type::isIntOrIntVectorTy(), llvm::User::operands(), llvm::Value::print(), llvm::Value::replaceAllUsesWith(), llvm::succ_begin(), llvm::succ_end(), TryToSinkInstruction(), llvm::Value::use_begin(), llvm::Value::use_empty(), and llvm::Value::user_begin().
| bool InstCombiner::SimplifyDivRemOfSelect | ( | BinaryOperator & | I | ) |
Try to fold a divide or remainder of a select instruction.
Definition at line 778 of file InstCombineMulDivRem.cpp.
References llvm::BasicBlock::begin(), E, llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Value::hasOneUse(), I, llvm::User::setOperand(), SI, llvm::ARM_MB::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 652 of file InstCombineAndOrXor.cpp.
References llvm::computeKnownBits(), 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(), llvm::KnownBits::isNonNegative(), 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 710 of file InstCombinePHI.cpp.
References llvm::PHINode::addIncoming(), llvm::array_pod_sort(), assert(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::PHINode::Create(), llvm::dbgs(), DEBUG, llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::find(), 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(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::RegState::Undef, llvm::Instruction::user_back(), and llvm::Value::users().
| Instruction * InstCombiner::visitAdd | ( | BinaryOperator & | I | ) |
Definition at line 1014 of file InstCombineAddSub.cpp.
References A, llvm::AddOne(), B, checkForNegativeOperand(), llvm::computeKnownBits(), llvm::SelectInst::Create(), CreateAdd(), llvm::BinaryOperator::CreateNeg(), llvm::DL, llvm::dyn_cast(), foldAddWithConstant(), llvm::ConstantInt::get(), llvm::ConstantExpr::getAdd(), llvm::SelectInst::getCondition(), llvm::SelectInst::getFalseValue(), llvm::APInt::getHighBitsSet(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::ConstantExpr::getSExt(), llvm::SelectInst::getTrueValue(), llvm::ConstantExpr::getTrunc(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::ConstantExpr::getXor(), llvm::ConstantExpr::getZExt(), llvm::Instruction::hasNoSignedWrap(), llvm::Instruction::hasNoUnsignedWrap(), llvm::Value::hasOneUse(), llvm::haveNoCommonBitsSet(), I, llvm::Type::isIntOrIntVectorTy(), llvm::APInt::isPowerOf2(), llvm::APInt::isSignMask(), llvm::APInt::logBase2(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_c_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::BitmaskEnumDetail::Mask(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), N, llvm::Instruction::setHasNoSignedWrap(), llvm::Instruction::setHasNoUnsignedWrap(), SI, llvm::SimplifyAddInst(), llvm::SubOne(), X, and llvm::KnownBits::Zero.
| Instruction * InstCombiner::visitAddrSpaceCast | ( | AddrSpaceCastInst & | CI | ) |
Definition at line 2217 of file InstCombineCasts.cpp.
References llvm::VectorType::get(), llvm::PointerType::get(), llvm::PointerType::getAddressSpace(), llvm::PointerType::getElementType(), llvm::User::getOperand(), llvm::Type::getScalarType(), and llvm::Value::getType().
| Instruction * InstCombiner::visitAllocaInst | ( | AllocaInst & | AI | ) |
Definition at line 341 of file InstCombineLoadStoreAlloca.cpp.
References llvm::dbgs(), DEBUG, llvm::dyn_cast(), eraseInstFromFunction(), llvm::ConstantInt::get(), llvm::PointerType::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(), isDereferenceableForAllocaSize(), isOnlyCopiedFromConstantGlobal(), llvm::Type::isSized(), llvm::max(), 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 2088 of file InstructionCombining.cpp.
References llvm::InvokeInst::Create(), llvm::DL, F, llvm::ConstantInt::get(), llvm::UndefValue::get(), llvm::Value::getContext(), llvm::Intrinsic::getDeclaration(), llvm::Type::getInt1Ty(), llvm::Value::getType(), isAllocSiteRemovable(), llvm::lowerObjectSizeCall(), llvm::None, llvm::SmallVectorTemplateCommon< T >::size(), and Users.
Referenced by visitAllocaInst().
| Instruction * InstCombiner::visitAnd | ( | BinaryOperator & | I | ) |
Definition at line 1261 of file InstCombineAndOrXor.cpp.
References llvm::MCID::Add, llvm::BinaryOperator::Create(), llvm::dyn_cast(), foldAndToXor(), foldBoolSextMaskToSelect(), llvm::ConstantInt::get(), llvm::ConstantExpr::getAnd(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::ConstantExpr::getTrunc(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::Value::hasOneUse(), I, llvm::IsFreeToInvert(), llvm::APInt::isIntN(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_c_BinOp(), llvm::PatternMatch::m_c_Or(), llvm::PatternMatch::m_c_Xor(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_LogicalShift(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::PatternMatch::m_ZExt(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), matchDeMorgansLaws(), llvm::MCID::Select, llvm::SimplifyAndInst(), SimplifyBSwap(), std::swap(), X, and Y.
| Instruction * InstCombiner::visitAShr | ( | BinaryOperator & | I | ) |
Definition at line 726 of file InstCombineShifts.cpp.
References llvm::BinaryOperator::Create(), llvm::ConstantInt::get(), llvm::APInt::getLowBitsSet(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::APInt::getSignMask(), llvm::Value::getType(), llvm::APInt::getZExtValue(), I, llvm::Instruction::isExact(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_NSWShl(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_ZExt(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), fuzzer::min(), llvm::Instruction::setIsExact(), llvm::SimplifyAShrInst(), and X.
| Instruction * InstCombiner::visitBitCast | ( | BitCastInst & | CI | ) |
Definition at line 2075 of file InstCombineCasts.cpp.
References canonicalizeBitCastExtElt(), llvm::CastInst::Create(), llvm::InsertElementInst::Create(), llvm::GetElementPtrInst::CreateInBounds(), foldBitCastBitwiseLogic(), foldBitCastSelect(), llvm::UndefValue::get(), llvm::Value::getContext(), llvm::PointerType::getElementType(), llvm::Type::getInt32Ty(), llvm::Constant::getNullValue(), llvm::Type::getNumContainedTypes(), llvm::User::getOperand(), llvm::Type::getScalarType(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), llvm::Type::isPointerTy(), llvm::Type::isSized(), llvm::Type::isVectorTy(), optimizeIntegerToVectorInsertions(), and optimizeVectorResize().
| Instruction * InstCombiner::visitBranchInst | ( | BranchInst & | BI | ) |
Definition at line 2246 of file InstructionCombining.cpp.
References llvm::UndefValue::get(), llvm::BranchInst::getCondition(), llvm::CmpInst::getInversePredicate(), llvm::BranchInst::getSuccessor(), llvm::Value::getType(), llvm::isCanonicalPredicate(), llvm::BranchInst::isConditional(), llvm::PatternMatch::m_Br(), llvm::PatternMatch::m_Cmp(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::BranchInst::setCondition(), llvm::CmpInst::setPredicate(), llvm::BranchInst::swapSuccessors(), and X.
| Instruction * InstCombiner::visitCallInst | ( | CallInst & | CI | ) |
CallInst simplification.
This mostly only handles folding of intrinsic instructions. For normal calls, it allows visitCallSite to do the heavy lifting.
Definition at line 1859 of file InstCombineCalls.cpp.
References A, llvm::MCID::Add, llvm::CallInst::addAttribute(), llvm::CallInst::arg_operands(), llvm::AMDGPU::CodeObject::Kernel::Key::Args, assert(), B, C, llvm::computeKnownBits(), llvm::MCID::Convergent, llvm::APFloat::convert(), llvm::Instruction::copyFastMathFlags(), llvm::CastInst::Create(), llvm::SelectInst::Create(), llvm::CastInst::CreateIntegerCast(), llvm::APFloat::divide(), llvm::DL, llvm::Function::doesNotThrow(), llvm::CallInst::doesNotThrow(), llvm::dyn_cast(), emitX86MaskSelect(), F, llvm::CmpInst::FIRST_FCMP_PREDICATE, llvm::CmpInst::FIRST_ICMP_PREDICATE, fmed3AMDGCN(), foldCtpop(), foldCttzCtlz(), llvm::frexp(), llvm::AttributeList::FunctionIndex, llvm::ConstantInt::get(), llvm::MetadataAsValue::get(), llvm::ConstantFP::get(), llvm::ConstantAggregateZero::get(), llvm::VectorType::get(), llvm::ConstantVector::get(), llvm::ConstantPointerNull::get(), llvm::MDString::get(), llvm::MDNode::get(), llvm::UndefValue::get(), llvm::APInt::getAllOnesValue(), llvm::CallInst::getArgOperand(), getBitWidth(), llvm::CallInst::getCalledFunction(), llvm::CallInst::getCalledValue(), llvm::ConstantExpr::getCompare(), llvm::Intrinsic::getDeclaration(), llvm::Instruction::getFastMathFlags(), llvm::Instruction::getFunction(), llvm::Type::getHalfTy(), llvm::Type::getInt32Ty(), llvm::Type::getIntegerBitWidth(), llvm::ConstantExpr::getIntegerCast(), llvm::IntrinsicInst::getIntrinsicID(), llvm::CmpInst::getInversePredicate(), llvm::getKnownAlignment(), llvm::ElementUnorderedAtomicMemCpyInst::getLength(), llvm::APInt::getLowBitsSet(), llvm::Instruction::getModule(), llvm::ConstantExpr::getMul(), llvm::Value::getName(), getNegativeIsTrueBoolVec(), llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), llvm::Constant::getNullValue(), llvm::Instruction::getOpcode(), llvm::getOrEnforceKnownAlignment(), llvm::Instruction::getParent(), llvm::Type::getPrimitiveSizeInBits(), llvm::APFloat::getSemantics(), llvm::ConstantExpr::getSExt(), llvm::CmpInst::getSwappedPredicate(), llvm::BasicBlock::getTerminator(), llvm::ConstantInt::getType(), llvm::Value::getType(), llvm::PointerType::getUnqual(), llvm::ConstantFP::getValueAPF(), llvm::Type::getVectorNumElements(), llvm::ConstantInt::getZExtValue(), llvm::Value::hasOneUse(), llvm::Instruction::hasUnsafeAlgebra(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::APFloatBase::IEK_Inf, llvm::APFloatBase::IEK_NaN, llvm::IntrinsicIDToOverflowCheckFlavor(), llvm::KnownBits::isAllOnes(), llvm::APFloat::isDenormal(), llvm::CmpInst::isFPPredicate(), llvm::isFreeCall(), llvm::APFloat::isInfinity(), llvm::Type::isIntegerTy(), llvm::isKnownNonNullAt(), llvm::DataLayout::isLittleEndian(), llvm::APFloat::isNaN(), llvm::APFloat::isNegative(), llvm::APFloat::isNormal(), llvm::Constant::isNullValue(), llvm::Type::isPointerTy(), llvm::APFloat::isSignaling(), llvm::isValidAssumeForContext(), llvm::APFloat::isZero(), llvm::CmpInst::LAST_FCMP_PREDICATE, llvm::CmpInst::LAST_ICMP_PREDICATE, LLVM_FALLTHROUGH, llvm_unreachable(), llvm::SPII::Load, llvm::lowerObjectSizeCall(), llvm::APInt::lshr(), llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_BitReverse(), llvm::PatternMatch::m_BSwap(), llvm::PatternMatch::m_Cmp(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_FNeg(), llvm::PatternMatch::m_FPExt(), llvm::PatternMatch::m_FPOne(), llvm::PatternMatch::m_FSub(), llvm::PatternMatch::m_ICmp(), llvm::PatternMatch::m_Instruction(), llvm::PatternMatch::m_NaN(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Select(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::m_ZExt(), llvm::PatternMatch::m_ZExtOrSExt(), llvm::BitmaskEnumDetail::Mask(), llvm::PatternMatch::match(), llvm::maxnum(), llvm::LLVMContext::MD_nonnull, llvm::minnum(), N, llvm::SIInstrFlags::N_INFINITY, llvm::SIInstrFlags::N_NORMAL, llvm::SIInstrFlags::N_SUBNORMAL, llvm::SIInstrFlags::N_ZERO, llvm::None, llvm::OCF_INVALID, llvm::APFloatBase::opOK, llvm::SIInstrFlags::P_INFINITY, llvm::SIInstrFlags::P_NORMAL, llvm::SIInstrFlags::P_SUBNORMAL, llvm::SIInstrFlags::P_ZERO, Ptr, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SIInstrFlags::Q_NAN, removeTriviallyEmptyRange(), llvm::AttributeList::ReturnIndex, llvm::APFloatBase::rmNearestTiesToEven, llvm::APFloatBase::rmTowardZero, round(), llvm::SIInstrFlags::S_NAN, llvm::CallInst::setArgOperand(), llvm::CallInst::setCalledFunction(), llvm::CallInst::setDoesNotThrow(), llvm::Instruction::setMetadata(), Signed, llvm::SimplifyCall(), simplifyMaskedGather(), simplifyMaskedLoad(), simplifyMaskedScatter(), simplifyMaskedStore(), simplifyMinnumMaxnum(), SimplifyNVVMIntrinsic(), simplifyX86extrq(), simplifyX86immShift(), simplifyX86insertps(), simplifyX86insertq(), simplifyX86MaskedLoad(), simplifyX86MaskedStore(), simplifyX86movmsk(), simplifyX86muldq(), simplifyX86pack(), simplifyX86pshufb(), simplifyX86varShift(), simplifyX86vpcom(), simplifyX86vperm2(), simplifyX86vpermilvar(), simplifyX86vpermv(), std::swap(), llvm::Value::takeName(), X, and llvm::APInt::zextOrTrunc().
| Instruction * InstCombiner::visitExtractElementInst | ( | ExtractElementInst & | EI | ) |
Definition at line 146 of file InstCombineVectorOps.cpp.
References assert(), C, cheapToScalarize(), llvm::CastInst::Create(), llvm::SelectInst::Create(), llvm::ExtractElementInst::Create(), llvm::BinaryOperator::CreateWithCopiedFlags(), llvm::findScalarElement(), llvm::ConstantInt::get(), llvm::UndefValue::get(), llvm::Value::getContext(), llvm::ExtractElementInst::getIndexOperand(), llvm::Type::getInt32Ty(), llvm::Value::getName(), llvm::SequentialType::getNumElements(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), llvm::ExtractElementInst::getVectorOperand(), llvm::ExtractElementInst::getVectorOperandType(), llvm::Value::hasOneUse(), I, llvm::ARM_PROC::IE, Int32Ty, llvm::Type::isVectorTy(), llvm::APInt::setBit(), llvm::User::setOperand(), SI, and llvm::SimplifyExtractElementInst().
| Instruction * InstCombiner::visitExtractValueInst | ( | ExtractValueInst & | EV | ) |
Definition at line 2334 of file InstructionCombining.cpp.
References llvm::ExtractValueInst::Create(), llvm::InsertValueInst::Create(), CreateAdd(), CreateMul(), E, GEP, llvm::UndefValue::get(), llvm::ExtractValueInst::getAggregateOperand(), llvm::ExtractValueInst::getIndices(), llvm::ConstantExpr::getNot(), llvm::Value::getType(), llvm::ExtractValueInst::hasIndices(), llvm::Value::hasOneUse(), I, llvm::CmpInst::ICMP_UGT, llvm::ExtractValueInst::idx_begin(), llvm::ExtractValueInst::idx_end(), llvm::makeArrayRef(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::Instruction::setAAMetadata(), and llvm::SimplifyExtractValueInst().
| Instruction * InstCombiner::visitFAdd | ( | BinaryOperator & | I | ) |
Definition at line 1301 of file InstCombineAddSub.cpp.
References A, B, llvm::Instruction::copyFastMathFlags(), llvm::SelectInst::Create(), llvm::dyn_cast(), llvm::Instruction::getFastMathFlags(), llvm::Type::getFltSemantics(), llvm::ConstantExpr::getFPToSI(), llvm::Type::getIntegerBitWidth(), llvm::User::getOperand(), llvm::Type::getScalarType(), llvm::ConstantExpr::getSIToFP(), llvm::Value::getType(), llvm::Instruction::hasNoSignedZeros(), llvm::Instruction::hasUnsafeAlgebra(), llvm::Constant::isNegativeZeroValue(), llvm::PatternMatch::m_AnyZero(), llvm::PatternMatch::m_Select(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::APFloatBase::semanticsPrecision(), 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 4935 of file InstCombineCompares.cpp.
References llvm::MCID::Call, llvm::APFloat::clearSign(), llvm::APFloatBase::cmpLessThan, llvm::APFloat::compare(), llvm::APFloat::convert(), 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, llvm::ConstantFP::get(), llvm::CallInst::getArgOperand(), llvm::getComplexity(), llvm::Value::getContext(), llvm::Instruction::getFastMathFlags(), llvm::ConstantExpr::getFNeg(), llvm::getIntrinsicForCallSite(), llvm::Constant::getNullValue(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::CmpInst::getPredicate(), llvm::APFloat::getSmallestNormalized(), llvm::CastInst::getSrcTy(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::GlobalVariable::hasDefinitiveInitializer(), llvm::Value::hasOneUse(), I, llvm::APFloatBase::IEEEdouble(), llvm::APFloatBase::IEEEhalf(), llvm::APFloatBase::IEEEquad(), llvm::APFloatBase::IEEEsingle(), llvm::GlobalVariable::isConstant(), llvm::Type::isDoubleTy(), llvm::Type::isFloatTy(), llvm::Type::isFP128Ty(), llvm::Type::isHalfTy(), llvm::Constant::isNullValue(), 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::APFloatBase::PPCDoubleDouble(), llvm::APFloatBase::rmNearestTiesToEven, llvm::User::setOperand(), llvm::CmpInst::setPredicate(), llvm::SimplifyFCmpInst(), llvm::FCmpInst::swapOperands(), llvm::Value::user_begin(), X, llvm::APFloatBase::x87DoubleExtended(), and Y.
| Instruction * InstCombiner::visitFDiv | ( | BinaryOperator & | I | ) |
Definition at line 1283 of file InstCombineMulDivRem.cpp.
References C, CvtFDivConstToReciprocal(), Flags, llvm::Instruction::getDebugLoc(), llvm::Instruction::getFastMathFlags(), llvm::ConstantExpr::getFDiv(), llvm::ConstantExpr::getFMul(), llvm::User::getOperand(), llvm::Instruction::hasAllowReciprocal(), llvm::Value::hasOneUse(), llvm::Instruction::hasUnsafeAlgebra(), I, isNormalFp(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_FDiv(), llvm::PatternMatch::m_FMul(), llvm::PatternMatch::m_FNeg(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::Instruction::setFastMathFlags(), llvm::User::setOperand(), SI, llvm::SimplifyFDivInst(), T, X, and Y.
| Instruction * InstCombiner::visitFenceInst | ( | FenceInst & | FI | ) |
Definition at line 3734 of file InstCombineCalls.cpp.
References llvm::ilist_node_with_parent< NodeTy, ParentTy, Options >::getNextNode(), and llvm::Instruction::isIdenticalTo().
| Instruction * InstCombiner::visitFMul | ( | BinaryOperator & | I | ) |
Definition at line 592 of file InstCombineMulDivRem.cpp.
References C, llvm::Instruction::copyFastMathFlags(), detectLog2OfHalf(), llvm::dyn_cast(), llvm::Instruction::getFastMathFlags(), llvm::ConstantExpr::getFMul(), llvm::Value::getName(), 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::CallInst::setArgOperand(), llvm::SimplifyFMulInst(), std::swap(), llvm::Value::takeName(), and Y.
| Instruction * InstCombiner::visitFPExt | ( | CastInst & | CI | ) |
Definition at line 1488 of file InstCombineCasts.cpp.
| Instruction * InstCombiner::visitFPToSI | ( | FPToSIInst & | FI | ) |
Definition at line 1547 of file InstCombineCasts.cpp.
References llvm::dyn_cast(), llvm::User::getOperand(), and I.
| Instruction * InstCombiner::visitFPToUI | ( | FPToUIInst & | FI | ) |
Definition at line 1536 of file InstCombineCasts.cpp.
References llvm::dyn_cast(), llvm::User::getOperand(), and I.
| Instruction * InstCombiner::visitFPTrunc | ( | FPTruncInst & | CI | ) |
Definition at line 1306 of file InstCombineCasts.cpp.
References llvm::AMDGPU::CodeObject::Kernel::Key::Args, llvm::Instruction::copyFastMathFlags(), llvm::BinaryOperator::Create(), llvm::CallInst::Create(), llvm::SelectInst::Create(), llvm::BinaryOperator::CreateFNeg(), llvm::CastInst::CreateFPCast(), llvm::dyn_cast(), llvm::SelectPatternResult::Flavor, llvm::CallInst::getArgOperand(), llvm::Intrinsic::getDeclaration(), llvm::Type::getFPMantissaWidth(), llvm::IntrinsicInst::getIntrinsicID(), llvm::Instruction::getModule(), llvm::Value::getName(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::OperandBundleUser< InstrTy, OpIteratorTy >::getOperandBundlesAsDefs(), llvm::Value::getType(), llvm::Value::hasOneUse(), I, llvm::BinaryOperator::isFNeg(), lookThroughFPExtensions(), llvm::matchSelectPattern(), llvm::max(), round(), shrinkInsertElt(), SI, and llvm::SPF_UNKNOWN.
| Instruction * InstCombiner::visitFree | ( | CallInst & | FI | ) |
Definition at line 2199 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 1584 of file InstCombineMulDivRem.cpp.
References llvm::Instruction::getFastMathFlags(), llvm::User::getOperand(), I, and llvm::SimplifyFRemInst().
| Instruction * InstCombiner::visitFSub | ( | BinaryOperator & | I | ) |
Definition at line 1698 of file InstCombineAddSub.cpp.
References llvm::Instruction::copyFastMathFlags(), llvm::BinaryOperator::CreateFNeg(), llvm::Instruction::getFastMathFlags(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Instruction::hasUnsafeAlgebra(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::match(), llvm::FastMathFlags::noSignedZeros(), 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 1451 of file InstructionCombining.cpp.
References llvm::GetElementPtrInst::accumulateConstantOffset(), llvm::PHINode::addIncoming(), llvm::SmallVectorImpl< T >::append(), assert(), C, llvm::Instruction::clone(), llvm::CastInst::Create(), llvm::GetElementPtrInst::Create(), llvm::GetElementPtrInst::CreateInBounds(), llvm::CastInst::CreatePointerBitCastOrAddrSpaceCast(), llvm::DL, llvm::dyn_cast(), E, llvm::SmallVectorBase::empty(), F, GEP, llvm::gep_type_begin(), llvm::gep_type_end(), llvm::VectorType::get(), llvm::PointerType::getAddressSpace(), llvm::GetElementPtrInst::getAddressSpace(), llvm::Type::getArrayElementType(), llvm::PointerType::getElementType(), llvm::BasicBlock::getFirstInsertionPt(), llvm::PHINode::getIncomingBlock(), llvm::generic_gep_type_iterator< ItTy >::getIndexedType(), llvm::BasicBlock::getInstList(), llvm::DataLayout::getIntPtrType(), 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::GetElementPtrInst::getPointerOperandType(), llvm::DataLayout::getPointerSizeInBits(), llvm::DataLayout::getPointerTypeSizeInBits(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::APInt::getSExtValue(), llvm::GetElementPtrInst::getSourceElementType(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::Type::getVectorNumElements(), llvm::Value::hasOneUse(), I, llvm::GetElementPtrInst::idx_begin(), llvm::GetElementPtrInst::idx_end(), llvm::iplist_impl< IntrusiveListT, TraitsT >::insert(), llvm::isAllocationFn(), llvm::Type::isArrayTy(), llvm::GetElementPtrInst::isInBounds(), llvm::APInt::isNonNegative(), llvm::Type::isSized(), llvm::generic_gep_type_iterator< ItTy >::isStruct(), llvm::Type::isStructTy(), llvm::Type::isVectorTy(), 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::makeArrayRef(), llvm::PatternMatch::match(), llvm::User::op_begin(), llvm::User::op_end(), llvm::User::operands(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::User::setOperand(), llvm::GetElementPtrInst::setSourceElementType(), shouldMergeGEPs(), llvm::SimplifyAddInst(), llvm::SimplifyGEPInst(), llvm::Value::stripAndAccumulateInBoundsConstantOffsets(), llvm::Value::stripPointerCasts(), llvm::Value::takeName(), llvm::APInt::ule(), 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 4461 of file InstCombineCompares.cpp.
References A, assert(), B, C, canonicalizeCmpWithConstant(), canonicalizeICmpBool(), llvm::CmpInst::Create(), llvm::ExtractValueInst::Create(), foldICmpWithMinMax(), llvm::ConstantInt::get(), llvm::Constant::getAllOnesValue(), llvm::ConstantExpr::getBitCast(), llvm::getComplexity(), llvm::CmpInst::getInversePredicate(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::GetUnderlyingObject(), llvm::Value::hasOneUse(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::CmpInst::ICMP_UGT, llvm::CmpInst::ICMP_ULT, llvm::ICmpInst::isEquality(), llvm::Type::isIntOrIntVectorTy(), llvm::isKnownToBeAPowerOfTwo(), llvm::APInt::isMaxSignedValue(), llvm::APInt::isMinSignedValue(), llvm::Type::isPointerTy(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Instruction(), llvm::PatternMatch::m_Mul(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Select(), llvm::PatternMatch::m_UAddWithOverflow(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::m_ZExt(), llvm::PatternMatch::match(), llvm::OCF_UNSIGNED_ADD, processUMulZExtIdiom(), llvm::SimplifyICmpInst(), std::swap(), swapMayExposeCSEOpportunities(), llvm::ICmpInst::swapOperands(), llvm::Value::user_begin(), and X.
| Instruction * InstCombiner::visitInsertElementInst | ( | InsertElementInst & | IE | ) |
Definition at line 778 of file InstCombineVectorOps.cpp.
References collectShuffleElements(), foldConstantInsEltIntoShuffle(), foldInsSequenceIntoBroadcast(), llvm::ConstantVector::get(), llvm::UndefValue::get(), llvm::APInt::getAllOnesValue(), llvm::SequentialType::getNumElements(), llvm::User::getOperand(), llvm::Value::getType(), llvm::InsertElementInst::getType(), llvm::Type::getVectorNumElements(), llvm::Value::hasOneUse(), hoistInsEltConst(), llvm::ARM_PROC::IE, llvm::BitmaskEnumDetail::Mask(), 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 550 of file InstCombineVectorOps.cpp.
References llvm::Depth, llvm::dyn_cast(), llvm::InsertValueInst::getIndices(), llvm::User::getOperand(), llvm::Value::hasOneUse(), I, and llvm::Value::user_back().
|
inline |
Specify what to return for unhandled instructions.
Definition at line 340 of file InstCombineInternal.h.
| Instruction * InstCombiner::visitIntToPtr | ( | IntToPtrInst & | CI | ) |
Definition at line 1566 of file InstCombineCasts.cpp.
References llvm::DL, llvm::VectorType::get(), llvm::IntToPtrInst::getAddressSpace(), llvm::Value::getContext(), llvm::DataLayout::getIntPtrType(), llvm::User::getOperand(), llvm::DataLayout::getPointerSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), llvm::Type::isVectorTy(), and P.
| Instruction * InstCombiner::visitInvokeInst | ( | InvokeInst & | II | ) |
Definition at line 3744 of file InstCombineCalls.cpp.
| Instruction * InstCombiner::visitLandingPadInst | ( | LandingPadInst & | LI | ) |
Definition at line 2519 of file InstructionCombining.cpp.
References llvm::LandingPadInst::addClause(), assert(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::classifyEHPersonality(), llvm::LandingPadInst::Create(), llvm::dyn_cast(), llvm::SmallVectorBase::empty(), llvm::SmallVectorImpl< T >::erase(), llvm::Filter, llvm::ArrayType::get(), llvm::ConstantArray::get(), llvm::LandingPadInst::getClause(), llvm::SequentialType::getElementType(), llvm::Constant::getNullValue(), llvm::LandingPadInst::getNumClauses(), llvm::SequentialType::getNumElements(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::Function::getPersonalityFn(), 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 946 of file InstCombineLoadStoreAlloca.cpp.
References llvm::InstCombineWorklist::Add(), llvm::AMDGPU::CodeObject::Kernel::Arg::Key::Align, assert(), Builder, canSimplifyNullLoadOrGEP(), combineLoadToOperationType(), llvm::combineMetadataForCSE(), llvm::SelectInst::Create(), llvm::IRBuilder< T, Inserter >::CreateBitOrPointerCast(), llvm::IRBuilder< T, Inserter >::CreateLoad(), llvm::DefMaxInstsToScan, llvm::FindAvailableLoadedValue(), llvm::UndefValue::get(), llvm::DataLayout::getABITypeAlignment(), llvm::LoadInst::getAlignment(), llvm::Instruction::getDebugLoc(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::LoadInst::getOrdering(), llvm::getOrEnforceKnownAlignment(), llvm::Instruction::getParent(), llvm::LoadInst::getPointerAddressSpace(), llvm::DataLayout::getPrefTypeAlignment(), llvm::LoadInst::getSyncScopeID(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::isSafeToLoadUnconditionally(), llvm::LoadInst::isUnordered(), replaceGEPIdxWithZero(), replaceInstUsesWith(), llvm::LoadInst::setAlignment(), llvm::LoadInst::setAtomic(), llvm::Instruction::setDebugLoc(), llvm::User::setOperand(), SI, unpackLoadToAggregate(), llvm::NVPTX::PTXLdStInstCode::V2, and Worklist.
| Instruction * InstCombiner::visitLShr | ( | BinaryOperator & | I | ) |
Definition at line 616 of file InstCombineShifts.cpp.
References assert(), llvm::dyn_cast(), llvm::ConstantInt::get(), llvm::IntrinsicInst::getIntrinsicID(), llvm::APInt::getLowBitsSet(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::ConstantInt::getSigned(), llvm::Value::getType(), llvm::APInt::getZExtValue(), llvm::Value::hasOneUse(), I, llvm::Instruction::isExact(), llvm::Type::isIntegerTy(), llvm::isPowerOf2_32(), llvm::Log2_32(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Value(), llvm::BitmaskEnumDetail::Mask(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), fuzzer::min(), llvm::Instruction::setIsExact(), llvm::SimplifyLShrInst(), and X.
| Instruction * InstCombiner::visitMul | ( | BinaryOperator & | I | ) |
i1 mul -> i1 and.
Definition at line 172 of file InstCombineMulDivRem.cpp.
References llvm::APInt::abs(), CreateAdd(), CreateMul(), llvm::BinaryOperator::CreateNeg(), llvm::dyn_cast(), llvm::ConstantInt::get(), getLogBase2Vector(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::ConstantExpr::getSExt(), llvm::ConstantExpr::getShl(), llvm::ConstantExpr::getTrunc(), llvm::Value::getType(), llvm::ConstantExpr::getZExt(), llvm::Instruction::hasNoSignedWrap(), llvm::Instruction::hasNoUnsignedWrap(), llvm::Value::hasOneUse(), I, llvm::Instruction::isExact(), llvm::Type::isIntOrIntVectorTy(), 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::Instruction::setHasNoSignedWrap(), llvm::Instruction::setHasNoUnsignedWrap(), llvm::SimplifyMulInst(), X, and Y.
| Instruction * InstCombiner::visitOr | ( | BinaryOperator & | I | ) |
Definition at line 1952 of file InstCombineAndOrXor.cpp.
References A, B, C, llvm::SelectInst::Create(), D, llvm::dyn_cast(), foldOrToXor(), FoldOrWithConstants(), FoldXorWithConstants(), llvm::ConstantInt::get(), llvm::Value::getName(), llvm::User::getOperand(), llvm::ConstantExpr::getOr(), llvm::ConstantInt::getSigned(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::Value::hasOneUse(), I, llvm::Type::isIntOrIntVectorTy(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_c_Or(), llvm::PatternMatch::m_c_Xor(), llvm::PatternMatch::m_ConstantInt(), 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(), matchDeMorgansLaws(), matchSelectFromAndOr(), llvm::MipsISD::Ret, SimplifyBSwap(), llvm::SimplifyOrInst(), std::swap(), llvm::Value::takeName(), llvm::NVPTX::PTXLdStInstCode::V2, X, and Y.
| Instruction * InstCombiner::visitPHINode | ( | PHINode & | PN | ) |
Definition at line 882 of file InstCombinePHI.cpp.
References llvm::BasicBlock::begin(), DeadPHICycle(), llvm::DL, llvm::dyn_cast(), llvm::UndefValue::get(), GetAnyNonZeroConstInt(), llvm::PHINode::getBasicBlockIndex(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::PHINode::getNumIncomingValues(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::Type::getPrimitiveSizeInBits(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::CmpInst::isEquality(), llvm::Type::isIntegerTy(), llvm::isKnownNonZero(), llvm::DataLayout::isLegalInteger(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::match(), PHIsEqualValue(), llvm::PHINode::setIncomingBlock(), llvm::PHINode::setIncomingValue(), llvm::SimplifyInstruction(), llvm::Instruction::user_back(), and llvm::codeview::VB.
| Instruction * InstCombiner::visitPtrToInt | ( | PtrToIntInst & | CI | ) |
Definition at line 1612 of file InstCombineCasts.cpp.
References llvm::CastInst::CreateIntegerCast(), llvm::DL, llvm::VectorType::get(), llvm::Value::getContext(), llvm::DataLayout::getIntPtrType(), llvm::User::getOperand(), llvm::PtrToIntInst::getPointerAddressSpace(), llvm::DataLayout::getPointerSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), llvm::Type::isVectorTy(), and P.
| Instruction * InstCombiner::visitReturnInst | ( | ReturnInst & | RI | ) |
Definition at line 2228 of file InstructionCombining.cpp.
References llvm::computeKnownBits(), llvm::KnownBits::getConstant(), llvm::Constant::getIntegerValue(), llvm::User::getNumOperands(), llvm::User::getOperand(), llvm::Value::getType(), llvm::KnownBits::isConstant(), llvm::Type::isIntegerTy(), and llvm::User::setOperand().
| Instruction * InstCombiner::visitSDiv | ( | BinaryOperator & | I | ) |
Definition at line 1171 of file InstCombineMulDivRem.cpp.
References llvm::BinaryOperator::CreateNeg(), llvm::APInt::exactLogBase2(), llvm::ConstantInt::get(), llvm::APInt::getMinSignedBits(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::APInt::getSignMask(), llvm::ConstantExpr::getTrunc(), llvm::Value::getType(), llvm::APInt::isAllOnesValue(), llvm::Instruction::isExact(), llvm::isKnownToBeAPowerOfTwo(), llvm::APInt::isNonNegative(), llvm::APInt::isPowerOf2(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_NSWSub(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Zero(), llvm::BitmaskEnumDetail::Mask(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::SimplifySDivInst(), and X.
| Instruction* llvm::InstCombiner::visitSelectInst | ( | SelectInst & | SI | ) |
| Instruction * InstCombiner::visitSExt | ( | SExtInst & | CI | ) |
Definition at line 1177 of file InstCombineCasts.cpp.
References A, assert(), canEvaluateSExtd(), llvm::computeKnownBits(), llvm::ComputeNumSignBits(), llvm::dbgs(), DEBUG, llvm::ConstantInt::get(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::KnownBits::isNonNegative(), llvm::Type::isVectorTy(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::Instruction::user_back(), and X.
| Instruction * InstCombiner::visitShl | ( | BinaryOperator & | I | ) |
Definition at line 517 of file InstCombineShifts.cpp.
References llvm::ComputeNumSignBits(), llvm::BinaryOperator::Create(), CreateMul(), llvm::ConstantInt::get(), llvm::APInt::getHighBitsSet(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::ConstantExpr::getShl(), llvm::Value::getType(), llvm::APInt::getZExtValue(), llvm::Instruction::hasNoSignedWrap(), llvm::Instruction::hasNoUnsignedWrap(), I, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_Exact(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Mul(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Shr(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_ZExt(), llvm::BitmaskEnumDetail::Mask(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::Instruction::setHasNoSignedWrap(), llvm::Instruction::setHasNoUnsignedWrap(), llvm::SimplifyShlInst(), and X.
| Instruction * InstCombiner::visitShuffleVectorInst | ( | ShuffleVectorInst & | SVI | ) |
Definition at line 1138 of file InstCombineVectorOps.cpp.
References assert(), CanEvaluateShuffled(), llvm::DL, llvm::dyn_cast(), E, 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::ShuffleVectorInst::getMask(), llvm::Value::getName(), llvm::SequentialType::getNumElements(), llvm::User::getOperand(), llvm::ShuffleVectorInst::getShuffleMask(), llvm::Value::getType(), llvm::ShuffleVectorInst::getType(), llvm::DataLayout::getTypeSizeInBits(), llvm::Type::getVectorNumElements(), I, Int32Ty, isShuffleExtractingFromLHS(), isSplat(), llvm::VectorType::isValidElementType(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), recognizeIdentityMask(), llvm::User::setOperand(), llvm::SimplifyShuffleVectorInst(), llvm::SmallVectorTemplateCommon< T >::size(), and llvm::Value::users().
| Instruction * InstCombiner::visitSIToFP | ( | CastInst & | CI | ) |
Definition at line 1562 of file InstCombineCasts.cpp.
| Instruction * InstCombiner::visitSRem | ( | BinaryOperator & | I | ) |
Definition at line 1511 of file InstCombineMulDivRem.cpp.
References C, llvm::ConstantInt::get(), llvm::ConstantVector::get(), llvm::Constant::getAggregateElement(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::APInt::getSignMask(), llvm::Value::getType(), llvm::Type::getVectorNumElements(), I, llvm::APInt::isMinSignedValue(), llvm::APInt::isNegative(), llvm::PatternMatch::m_APInt(), llvm::BitmaskEnumDetail::Mask(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::User::setOperand(), llvm::SimplifySRemInst(), and Y.
| Instruction * InstCombiner::visitStoreInst | ( | StoreInst & | SI | ) |
Definition at line 1301 of file InstCombineLoadStoreAlloca.cpp.
References llvm::InstCombineWorklist::Add(), assert(), llvm::BasicBlock::begin(), combineStoreToValueType(), equivalentAddressValues(), eraseInstFromFunction(), GEP, llvm::UndefValue::get(), llvm::DataLayout::getABITypeAlignment(), llvm::StoreInst::getAlignment(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::User::getOperand(), llvm::getOrEnforceKnownAlignment(), llvm::Instruction::getParent(), llvm::StoreInst::getPointerAddressSpace(), llvm::DataLayout::getPrefTypeAlignment(), llvm::Value::getType(), llvm::Value::hasOneUse(), llvm::StoreInst::isUnordered(), Ptr, replaceGEPIdxWithZero(), llvm::StoreInst::setAlignment(), llvm::User::setOperand(), unpackStoreToAggregate(), and Worklist.
| Instruction * InstCombiner::visitSub | ( | BinaryOperator & | I | ) |
Definition at line 1491 of file InstCombineAddSub.cpp.
References A, llvm::MCID::Add, llvm::AddOne(), assert(), B, llvm::computeKnownBits(), CreateAdd(), llvm::BinaryOperator::CreateNeg(), llvm::BinaryOperator::CreateNot(), llvm::CastInst::CreateSExtOrBitCast(), llvm::CastInst::CreateZExtOrBitCast(), llvm::ConstantExpr::getNeg(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::ConstantExpr::getSub(), llvm::Value::getType(), llvm::Instruction::hasNoSignedWrap(), llvm::Instruction::hasNoUnsignedWrap(), llvm::Type::isIntOrIntVectorTy(), llvm::APInt::isMask(), llvm::Constant::isNotMinSignedValue(), llvm::APInt::isNullValue(), llvm::Constant::isOneValue(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_c_Add(), llvm::PatternMatch::m_c_And(), llvm::PatternMatch::m_c_Mul(), llvm::PatternMatch::m_c_Or(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Mul(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_OneUse(), 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::Instruction::setHasNoSignedWrap(), llvm::Instruction::setHasNoUnsignedWrap(), SI, llvm::SimplifySubInst(), X, Y, llvm::Z, and llvm::KnownBits::Zero.
| Instruction * InstCombiner::visitSwitchInst | ( | SwitchInst & | SI | ) |
Definition at line 2284 of file InstructionCombining.cpp.
References assert(), llvm::SwitchInst::cases(), llvm::computeKnownBits(), llvm::KnownBits::countMinLeadingOnes(), llvm::KnownBits::countMinLeadingZeros(), llvm::IntegerType::get(), llvm::ConstantInt::get(), llvm::KnownBits::getBitWidth(), llvm::SwitchInst::getCondition(), llvm::Value::getContext(), llvm::ConstantExpr::getSub(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::max(), fuzzer::min(), llvm::SwitchInst::setCondition(), and llvm::APInt::trunc().
| Instruction * InstCombiner::visitTrunc | ( | TruncInst & | CI | ) |
Definition at line 516 of file InstCombineCasts.cpp.
References A, assert(), canEvaluateTruncated(), llvm::BinaryOperator::Create(), llvm::CastInst::CreateIntegerCast(), llvm::dbgs(), DEBUG, llvm::SelectPatternResult::Flavor, foldVecTruncToExtElt(), llvm::ConstantInt::get(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::ConstantInt::getZExtValue(), llvm::Value::hasOneUse(), I, llvm::CmpInst::ICMP_NE, llvm::Type::isVectorTy(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Shr(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_ZExt(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), llvm::max(), fuzzer::min(), shrinkInsertElt(), shrinkSplatShuffle(), SI, llvm::SPF_UNKNOWN, llvm::Value::takeName(), llvm::APInt::trunc(), llvm::APInt::ult(), and Zero.
| Instruction * InstCombiner::visitUDiv | ( | BinaryOperator & | I | ) |
Definition at line 1098 of file InstCombineMulDivRem.cpp.
References llvm::SelectInst::Create(), dyn_castZExtVal(), llvm::ConstantInt::get(), llvm::User::getOperand(), llvm::Value::getType(), llvm::Instruction::insertBefore(), llvm::Instruction::isExact(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_Exact(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::Instruction::setIsExact(), llvm::SimplifyUDivInst(), llvm::APInt::ushl_ov(), visitUDivOperand(), and X.
| Instruction * InstCombiner::visitUIToFP | ( | CastInst & | CI | ) |
Definition at line 1558 of file InstCombineCasts.cpp.
| Instruction * InstCombiner::visitURem | ( | BinaryOperator & | I | ) |
Definition at line 1468 of file InstCombineMulDivRem.cpp.
References llvm::MCID::Add, llvm::SelectInst::Create(), dyn_castZExtVal(), llvm::MipsISD::Ext, llvm::Constant::getAllOnesValue(), llvm::User::getOperand(), llvm::Value::getType(), llvm::isKnownToBeAPowerOfTwo(), llvm::APInt::isNegative(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_One(), llvm::PatternMatch::match(), and llvm::SimplifyURemInst().
| Instruction * InstCombiner::visitVACopyInst | ( | VACopyInst & | I | ) |
Definition at line 1851 of file InstCombineCalls.cpp.
References removeTriviallyEmptyRange().
| Instruction * InstCombiner::visitVAStartInst | ( | VAStartInst & | I | ) |
Definition at line 1846 of file InstCombineCalls.cpp.
References removeTriviallyEmptyRange().
| Instruction * InstCombiner::visitXor | ( | BinaryOperator & | I | ) |
Definition at line 2345 of file InstCombineAndOrXor.cpp.
References A, llvm::MCID::Add, B, C, llvm::CastInst::Create(), CreateAdd(), llvm::BinaryOperator::CreateNot(), D, llvm::dyn_cast(), foldXorToXor(), llvm::ConstantInt::get(), llvm::ConstantExpr::getAnd(), llvm::ConstantExpr::getCast(), llvm::Instruction::getDebugLoc(), llvm::CmpInst::getInversePredicate(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), llvm::ConstantExpr::getNot(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::ConstantExpr::getOr(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::Value::hasOneUse(), I, llvm::IsFreeToInvert(), llvm::APInt::isNegative(), llvm::APInt::isNonNegative(), llvm::APInt::lshr(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_BinOp(), llvm::PatternMatch::m_c_And(), llvm::PatternMatch::m_c_Or(), llvm::PatternMatch::m_c_Xor(), llvm::PatternMatch::m_Cmp(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::User::setOperand(), SimplifyBSwap(), llvm::SimplifyXorInst(), llvm::SubOne(), std::swap(), llvm::BinaryOperator::swapOperands(), llvm::Value::takeName(), X, and Y.
| Instruction * InstCombiner::visitZExt | ( | ZExtInst & | CI | ) |
Definition at line 897 of file InstCombineCasts.cpp.
References A, assert(), C, 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::Value::getType(), llvm::ConstantExpr::getZExt(), llvm::Value::hasOneUse(), llvm::Type::isVectorTy(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_Constant(), 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::Instruction::user_back(), and X.
| BuilderTy& llvm::InstCombiner::Builder |
Definition at line 213 of file InstCombineInternal.h.
Referenced by canonicalizeBitCastExtElt(), combineLoadToNewType(), combineLoadToOperationType(), combineStoreToNewValue(), evaluateGEPOffsetExpression(), foldCttzCtlz(), foldUDivNegCst(), foldUDivShl(), foldVecTruncToExtElt(), getShiftedValue(), optimizeIntegerToVectorInsertions(), optimizeVectorResize(), processUGT_ADDCST_ADD(), processUMulZExtIdiom(), simplifyAllocaArraySize(), simplifyValueKnownNonZero(), simplifyX86MaskedLoad(), simplifyX86MaskedStore(), unpackLoadToAggregate(), unpackStoreToAggregate(), and visitLoadInst().
| uint64_t llvm::InstCombiner::MaxArraySizeForCombine |
Maximum size of array considered when transforming.
Definition at line 581 of file InstCombineInternal.h.
Referenced by combineInstructionsOverFunction(), unpackLoadToAggregate(), and unpackStoreToAggregate().
| InstCombineWorklist& llvm::InstCombiner::Worklist |
A worklist of the instructions that need to be simplified.
Definition at line 208 of file InstCombineInternal.h.
Referenced by getShiftedValue(), processUMulZExtIdiom(), visitLoadInst(), and visitStoreInst().
1.8.6