LLVM  11.0.0git
Public Types | Public Member Functions | Public Attributes | List of all members
llvm::InstCombiner Class Reference

The core instruction combiner logic. More...

#include "Transforms/InstCombine/InstCombineInternal.h"

Inheritance diagram for llvm::InstCombiner:
Inheritance graph
[legend]
Collaboration diagram for llvm::InstCombiner:
Collaboration graph
[legend]

Public Types

using BuilderTy = IRBuilder< TargetFolder, IRBuilderCallbackInserter >
 An IRBuilder that automatically inserts new instructions into the worklist. More...
 

Public Member Functions

 InstCombiner (InstCombineWorklist &Worklist, BuilderTy &Builder, bool MinimizeSize, AAResults *AA, AssumptionCache &AC, TargetLibraryInfo &TLI, DominatorTree &DT, OptimizationRemarkEmitter &ORE, BlockFrequencyInfo *BFI, ProfileSummaryInfo *PSI, const DataLayout &DL, LoopInfo *LI)
 
bool run ()
 Run the combiner over the entire worklist until it is empty. More...
 
AssumptionCachegetAssumptionCache () const
 
const DataLayoutgetDataLayout () const
 
DominatorTreegetDominatorTree () const
 
LoopInfogetLoopInfo () const
 
TargetLibraryInfogetTargetLibraryInfo () const
 
InstructionvisitFNeg (UnaryOperator &I)
 
InstructionvisitAdd (BinaryOperator &I)
 
InstructionvisitFAdd (BinaryOperator &I)
 
ValueOptimizePointerDifference (Value *LHS, Value *RHS, Type *Ty, bool isNUW)
 Optimize pointer differences into the same array into a size. More...
 
InstructionvisitSub (BinaryOperator &I)
 
InstructionvisitFSub (BinaryOperator &I)
 
InstructionvisitMul (BinaryOperator &I)
 
InstructionvisitFMul (BinaryOperator &I)
 
InstructionvisitURem (BinaryOperator &I)
 
InstructionvisitSRem (BinaryOperator &I)
 
InstructionvisitFRem (BinaryOperator &I)
 
bool simplifyDivRemOfSelectWithZeroOp (BinaryOperator &I)
 Fold a divide or remainder with a select instruction divisor when one of the select operands is zero. More...
 
InstructioncommonRemTransforms (BinaryOperator &I)
 
InstructioncommonIRemTransforms (BinaryOperator &I)
 This function implements the transforms common to both integer remainder instructions (urem and srem). More...
 
InstructioncommonDivTransforms (BinaryOperator &I)
 
InstructioncommonIDivTransforms (BinaryOperator &I)
 This function implements the transforms common to both integer division instructions (udiv and sdiv). More...
 
InstructionvisitUDiv (BinaryOperator &I)
 
InstructionvisitSDiv (BinaryOperator &I)
 
InstructionvisitFDiv (BinaryOperator &I)
 
ValuesimplifyRangeCheck (ICmpInst *Cmp0, ICmpInst *Cmp1, bool Inverted)
 Try to fold a signed range checked with lower bound 0 to an unsigned icmp. More...
 
InstructionvisitAnd (BinaryOperator &I)
 
InstructionvisitOr (BinaryOperator &I)
 
InstructionvisitXor (BinaryOperator &I)
 
InstructionvisitShl (BinaryOperator &I)
 
ValuereassociateShiftAmtsOfTwoSameDirectionShifts (BinaryOperator *Sh0, const SimplifyQuery &SQ, bool AnalyzeForSignBitExtraction=false)
 
InstructioncanonicalizeCondSignextOfHighBitExtractToSignextHighBitExtract (BinaryOperator &I)
 
InstructionfoldVariableSignZeroExtensionOfVariableHighBitExtract (BinaryOperator &OldAShr)
 
InstructionvisitAShr (BinaryOperator &I)
 
InstructionvisitLShr (BinaryOperator &I)
 
InstructioncommonShiftTransforms (BinaryOperator &I)
 
InstructionvisitFCmpInst (FCmpInst &I)
 
InstructionvisitICmpInst (ICmpInst &I)
 
InstructionFoldShiftByConstant (Value *Op0, Constant *Op1, BinaryOperator &I)
 
InstructioncommonCastTransforms (CastInst &CI)
 Implement the transforms common to all CastInst visitors. More...
 
InstructioncommonPointerCastTransforms (CastInst &CI)
 Implement the transforms for cast of pointer (bitcast/ptrtoint) More...
 
InstructionvisitTrunc (TruncInst &CI)
 
InstructionvisitZExt (ZExtInst &CI)
 
InstructionvisitSExt (SExtInst &CI)
 
InstructionvisitFPTrunc (FPTruncInst &CI)
 
InstructionvisitFPExt (CastInst &CI)
 
InstructionvisitFPToUI (FPToUIInst &FI)
 
InstructionvisitFPToSI (FPToSIInst &FI)
 
InstructionvisitUIToFP (CastInst &CI)
 
InstructionvisitSIToFP (CastInst &CI)
 
InstructionvisitPtrToInt (PtrToIntInst &CI)
 
InstructionvisitIntToPtr (IntToPtrInst &CI)
 
InstructionvisitBitCast (BitCastInst &CI)
 
InstructionvisitAddrSpaceCast (AddrSpaceCastInst &CI)
 
InstructionfoldItoFPtoI (CastInst &FI)
 fpto{s/u}i({u/s}itofp(X)) –> X or zext(X) or sext(X) or trunc(X) This is safe if the intermediate type has enough bits in its mantissa to accurately represent all values of X. More...
 
InstructionvisitSelectInst (SelectInst &SI)
 
InstructionvisitCallInst (CallInst &CI)
 CallInst simplification. More...
 
InstructionvisitInvokeInst (InvokeInst &II)
 
InstructionvisitCallBrInst (CallBrInst &CBI)
 
InstructionSliceUpIllegalIntegerPHI (PHINode &PN)
 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. More...
 
InstructionvisitPHINode (PHINode &PN)
 
InstructionvisitGetElementPtrInst (GetElementPtrInst &GEP)
 
InstructionvisitAllocaInst (AllocaInst &AI)
 
InstructionvisitAllocSite (Instruction &FI)
 
InstructionvisitFree (CallInst &FI)
 
InstructionvisitLoadInst (LoadInst &LI)
 
InstructionvisitStoreInst (StoreInst &SI)
 
InstructionvisitAtomicRMWInst (AtomicRMWInst &SI)
 
InstructionvisitBranchInst (BranchInst &BI)
 
InstructionvisitFenceInst (FenceInst &FI)
 
InstructionvisitSwitchInst (SwitchInst &SI)
 
InstructionvisitReturnInst (ReturnInst &RI)
 
InstructionvisitInsertValueInst (InsertValueInst &IV)
 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. More...
 
InstructionvisitInsertElementInst (InsertElementInst &IE)
 
InstructionvisitExtractElementInst (ExtractElementInst &EI)
 
InstructionvisitShuffleVectorInst (ShuffleVectorInst &SVI)
 
InstructionvisitExtractValueInst (ExtractValueInst &EV)
 
InstructionvisitLandingPadInst (LandingPadInst &LI)
 
InstructionvisitVAEndInst (VAEndInst &I)
 
InstructionvisitFreeze (FreezeInst &I)
 
InstructionvisitInstruction (Instruction &I)
 Specify what to return for unhandled instructions. More...
 
bool dominatesAllUses (const Instruction *DI, const Instruction *UI, const BasicBlock *DB) const
 True when DB dominates all uses of DI except UI. More...
 
bool replacedSelectWithOperand (SelectInst *SI, const ICmpInst *Icmp, const unsigned SIOpd)
 Try to replace select with select operand SIOpd in SI-ICmp sequence. More...
 
bool replacePointer (Instruction &I, Value *V)
 Try to replace instruction I with value V which are pointers in different address space. More...
 
LoadInstcombineLoadToNewType (LoadInst &LI, Type *NewTy, const Twine &Suffix="")
 Helper to combine a load to a new type. More...
 
InstructionInsertNewInstBefore (Instruction *New, Instruction &Old)
 Inserts an instruction New before instruction Old. More...
 
InstructionInsertNewInstWith (Instruction *New, Instruction &Old)
 Same as InsertNewInstBefore, but also sets the debug loc. More...
 
InstructionreplaceInstUsesWith (Instruction &I, Value *V)
 A combiner-aware RAUW-like routine. More...
 
InstructionreplaceOperand (Instruction &I, unsigned OpNum, Value *V)
 Replace operand of instruction and add old operand to the worklist. More...
 
void replaceUse (Use &U, Value *NewValue)
 Replace use and add the previously used value to the worklist. More...
 
InstructionCreateOverflowTuple (IntrinsicInst *II, Value *Result, Constant *Overflow)
 Creates a result tuple for an overflow intrinsic II with a given Result and a constant Overflow value. More...
 
void CreateNonTerminatorUnreachable (Instruction *InsertAt)
 Create and insert the idiom we use to indicate a block is unreachable without having to rewrite the CFG from within InstCombine. More...
 
InstructioneraseInstFromFunction (Instruction &I)
 Combiner aware instruction erasure. More...
 
void computeKnownBits (const Value *V, KnownBits &Known, unsigned Depth, const Instruction *CxtI) const
 
KnownBits computeKnownBits (const Value *V, unsigned Depth, const Instruction *CxtI) const
 
bool isKnownToBeAPowerOfTwo (const Value *V, bool OrZero=false, unsigned Depth=0, const Instruction *CxtI=nullptr)
 
bool MaskedValueIsZero (const Value *V, const APInt &Mask, unsigned Depth=0, const Instruction *CxtI=nullptr) const
 
unsigned ComputeNumSignBits (const Value *Op, unsigned Depth=0, const Instruction *CxtI=nullptr) const
 
OverflowResult computeOverflowForUnsignedMul (const Value *LHS, const Value *RHS, const Instruction *CxtI) const
 
OverflowResult computeOverflowForSignedMul (const Value *LHS, const Value *RHS, const Instruction *CxtI) const
 
OverflowResult computeOverflowForUnsignedAdd (const Value *LHS, const Value *RHS, const Instruction *CxtI) const
 
OverflowResult computeOverflowForSignedAdd (const Value *LHS, const Value *RHS, const Instruction *CxtI) const
 
OverflowResult computeOverflowForUnsignedSub (const Value *LHS, const Value *RHS, const Instruction *CxtI) const
 
OverflowResult computeOverflowForSignedSub (const Value *LHS, const Value *RHS, const Instruction *CxtI) const
 
OverflowResult computeOverflow (Instruction::BinaryOps BinaryOp, bool IsSigned, Value *LHS, Value *RHS, Instruction *CxtI) const
 
- Public Member Functions inherited from llvm::InstVisitor< InstCombiner, Instruction *>
void visit (Iterator Start, Iterator End)
 
void visit (Module &M)
 
void visit (Function &F)
 
void visit (BasicBlock &BB)
 
void visit (Module *M)
 
void visit (Function *F)
 
void visit (BasicBlock *BB)
 
Instructionvisit (Instruction *I)
 
Instructionvisit (Instruction &I)
 
void visitModule (Module &M)
 
void visitFunction (Function &F)
 
void visitBasicBlock (BasicBlock &BB)
 
InstructionvisitICmpInst (ICmpInst &I)
 
InstructionvisitFCmpInst (FCmpInst &I)
 
InstructionvisitAllocaInst (AllocaInst &I)
 
InstructionvisitLoadInst (LoadInst &I)
 
InstructionvisitStoreInst (StoreInst &I)
 
InstructionvisitAtomicCmpXchgInst (AtomicCmpXchgInst &I)
 
InstructionvisitAtomicRMWInst (AtomicRMWInst &I)
 
InstructionvisitFenceInst (FenceInst &I)
 
InstructionvisitGetElementPtrInst (GetElementPtrInst &I)
 
InstructionvisitPHINode (PHINode &I)
 
InstructionvisitTruncInst (TruncInst &I)
 
InstructionvisitZExtInst (ZExtInst &I)
 
InstructionvisitSExtInst (SExtInst &I)
 
InstructionvisitFPTruncInst (FPTruncInst &I)
 
InstructionvisitFPExtInst (FPExtInst &I)
 
InstructionvisitFPToUIInst (FPToUIInst &I)
 
InstructionvisitFPToSIInst (FPToSIInst &I)
 
InstructionvisitUIToFPInst (UIToFPInst &I)
 
InstructionvisitSIToFPInst (SIToFPInst &I)
 
InstructionvisitPtrToIntInst (PtrToIntInst &I)
 
InstructionvisitIntToPtrInst (IntToPtrInst &I)
 
InstructionvisitBitCastInst (BitCastInst &I)
 
InstructionvisitAddrSpaceCastInst (AddrSpaceCastInst &I)
 
InstructionvisitSelectInst (SelectInst &I)
 
InstructionvisitVAArgInst (VAArgInst &I)
 
InstructionvisitExtractElementInst (ExtractElementInst &I)
 
InstructionvisitInsertElementInst (InsertElementInst &I)
 
InstructionvisitShuffleVectorInst (ShuffleVectorInst &I)
 
InstructionvisitExtractValueInst (ExtractValueInst &I)
 
InstructionvisitInsertValueInst (InsertValueInst &I)
 
InstructionvisitLandingPadInst (LandingPadInst &I)
 
InstructionvisitFuncletPadInst (FuncletPadInst &I)
 
InstructionvisitCleanupPadInst (CleanupPadInst &I)
 
InstructionvisitCatchPadInst (CatchPadInst &I)
 
InstructionvisitFreezeInst (FreezeInst &I)
 
InstructionvisitDbgDeclareInst (DbgDeclareInst &I)
 
InstructionvisitDbgValueInst (DbgValueInst &I)
 
InstructionvisitDbgVariableIntrinsic (DbgVariableIntrinsic &I)
 
InstructionvisitDbgLabelInst (DbgLabelInst &I)
 
InstructionvisitDbgInfoIntrinsic (DbgInfoIntrinsic &I)
 
InstructionvisitMemSetInst (MemSetInst &I)
 
InstructionvisitMemCpyInst (MemCpyInst &I)
 
InstructionvisitMemMoveInst (MemMoveInst &I)
 
InstructionvisitMemTransferInst (MemTransferInst &I)
 
InstructionvisitMemIntrinsic (MemIntrinsic &I)
 
InstructionvisitVAStartInst (VAStartInst &I)
 
InstructionvisitVAEndInst (VAEndInst &I)
 
InstructionvisitVACopyInst (VACopyInst &I)
 
InstructionvisitIntrinsicInst (IntrinsicInst &I)
 
InstructionvisitCallInst (CallInst &I)
 
InstructionvisitInvokeInst (InvokeInst &I)
 
InstructionvisitCallBrInst (CallBrInst &I)
 
InstructionvisitReturnInst (ReturnInst &I)
 
InstructionvisitBranchInst (BranchInst &I)
 
InstructionvisitSwitchInst (SwitchInst &I)
 
InstructionvisitIndirectBrInst (IndirectBrInst &I)
 
InstructionvisitResumeInst (ResumeInst &I)
 
InstructionvisitUnreachableInst (UnreachableInst &I)
 
InstructionvisitCleanupReturnInst (CleanupReturnInst &I)
 
InstructionvisitCatchReturnInst (CatchReturnInst &I)
 
InstructionvisitCatchSwitchInst (CatchSwitchInst &I)
 
InstructionvisitTerminator (Instruction &I)
 
InstructionvisitCastInst (CastInst &I)
 
InstructionvisitUnaryOperator (UnaryOperator &I)
 
InstructionvisitBinaryOperator (BinaryOperator &I)
 
InstructionvisitCmpInst (CmpInst &I)
 
InstructionvisitUnaryInstruction (UnaryInstruction &I)
 
InstructionvisitCallBase (CallBase &I)
 
void visitInstruction (Instruction &I)
 

Public Attributes

InstCombineWorklistWorklist
 A worklist of the instructions that need to be simplified. More...
 
BuilderTyBuilder
 
uint64_t MaxArraySizeForCombine = 0
 Maximum size of array considered when transforming. More...
 

Detailed Description

The core instruction combiner logic.

This class provides both the logic to recursively visit instructions and combine them.

Definition at line 308 of file InstCombineInternal.h.

Member Typedef Documentation

◆ BuilderTy

An IRBuilder that automatically inserts new instructions into the worklist.

Definition at line 317 of file InstCombineInternal.h.

Constructor & Destructor Documentation

◆ InstCombiner()

llvm::InstCombiner::InstCombiner ( InstCombineWorklist Worklist,
BuilderTy Builder,
bool  MinimizeSize,
AAResults AA,
AssumptionCache AC,
TargetLibraryInfo TLI,
DominatorTree DT,
OptimizationRemarkEmitter ORE,
BlockFrequencyInfo BFI,
ProfileSummaryInfo PSI,
const DataLayout DL,
LoopInfo LI 
)
inline

Definition at line 343 of file InstCombineInternal.h.

Member Function Documentation

◆ canonicalizeCondSignextOfHighBitExtractToSignextHighBitExtract()

Instruction * InstCombiner::canonicalizeCondSignextOfHighBitExtractToSignextHighBitExtract ( BinaryOperator I)

◆ combineLoadToNewType()

LoadInst * InstCombiner::combineLoadToNewType ( LoadInst LI,
Type NewTy,
const Twine Suffix = "" 
)

Helper to combine a load to a new type.

This just does the work of combining a load to a new type. It handles metadata, etc., and returns the new instruction. The NewTy should be the loaded value type. This will convert it to a pointer, cast the operand to that pointer type, load it, etc.

Note that this will create all of the instructions with whatever insert point the InstCombiner currently is using.

Definition at line 425 of file InstCombineLoadStoreAlloca.cpp.

References assert(), Builder, llvm::copyMetadataForLoad(), llvm::LoadInst::getAlign(), llvm::Value::getName(), llvm::LoadInst::getOrdering(), llvm::LoadInst::getPointerAddressSpace(), llvm::Type::getPointerAddressSpace(), llvm::Type::getPointerElementType(), llvm::LoadInst::getPointerOperand(), llvm::Type::getPointerTo(), llvm::LoadInst::getSyncScopeID(), llvm::Value::getType(), llvm::Instruction::isAtomic(), isSupportedAtomicType(), llvm::LoadInst::isVolatile(), llvm::PatternMatch::m_BitCast(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), and llvm::LoadInst::setAtomic().

Referenced by combineLoadToOperationType(), removeBitcastsFromLoadStoreOnMinMax(), and unpackLoadToAggregate().

◆ commonCastTransforms()

Instruction * InstCombiner::commonCastTransforms ( CastInst CI)

◆ commonDivTransforms()

Instruction* llvm::InstCombiner::commonDivTransforms ( BinaryOperator I)

◆ commonIDivTransforms()

Instruction * InstCombiner::commonIDivTransforms ( BinaryOperator I)

◆ commonIRemTransforms()

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 1358 of file InstCombineMulDivRem.cpp.

References llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), I, llvm::APInt::isMinSignedValue(), llvm::APInt::isMinValue(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::match(), SI, and simplifyValueKnownNonZero().

◆ commonPointerCastTransforms()

Instruction * InstCombiner::commonPointerCastTransforms ( CastInst CI)

Implement the transforms for cast of pointer (bitcast/ptrtoint)

Definition at line 1906 of file InstCombineCasts.cpp.

References GEP, and llvm::User::getOperand().

◆ commonRemTransforms()

Instruction* llvm::InstCombiner::commonRemTransforms ( BinaryOperator I)

◆ commonShiftTransforms()

Instruction * InstCombiner::commonShiftTransforms ( BinaryOperator I)

◆ computeKnownBits() [1/2]

void llvm::InstCombiner::computeKnownBits ( const Value V,
KnownBits Known,
unsigned  Depth,
const Instruction CxtI 
) const
inline

Definition at line 745 of file InstCombineInternal.h.

References llvm::computeKnownBits().

Referenced by canReplaceGEPIdxWithZero(), foldCtpop(), and foldCttzCtlz().

◆ computeKnownBits() [2/2]

KnownBits llvm::InstCombiner::computeKnownBits ( const Value V,
unsigned  Depth,
const Instruction CxtI 
) const
inline

Definition at line 750 of file InstCombineInternal.h.

References llvm::computeKnownBits().

◆ ComputeNumSignBits()

unsigned llvm::InstCombiner::ComputeNumSignBits ( const Value Op,
unsigned  Depth = 0,
const Instruction CxtI = nullptr 
) const
inline

Definition at line 766 of file InstCombineInternal.h.

References llvm::ComputeNumSignBits(), and llvm::Depth.

Referenced by processUGT_ADDCST_ADD().

◆ computeOverflow()

OverflowResult InstCombiner::computeOverflow ( Instruction::BinaryOps  BinaryOp,
bool  IsSigned,
Value LHS,
Value RHS,
Instruction CxtI 
) const

◆ computeOverflowForSignedAdd()

OverflowResult llvm::InstCombiner::computeOverflowForSignedAdd ( const Value LHS,
const Value RHS,
const Instruction CxtI 
) const
inline

Definition at line 789 of file InstCombineInternal.h.

References llvm::computeOverflowForSignedAdd().

◆ computeOverflowForSignedMul()

OverflowResult llvm::InstCombiner::computeOverflowForSignedMul ( const Value LHS,
const Value RHS,
const Instruction CxtI 
) const
inline

Definition at line 777 of file InstCombineInternal.h.

References llvm::computeOverflowForSignedMul().

◆ computeOverflowForSignedSub()

OverflowResult llvm::InstCombiner::computeOverflowForSignedSub ( const Value LHS,
const Value RHS,
const Instruction CxtI 
) const
inline

Definition at line 801 of file InstCombineInternal.h.

References llvm::computeOverflowForSignedSub().

◆ computeOverflowForUnsignedAdd()

OverflowResult llvm::InstCombiner::computeOverflowForUnsignedAdd ( const Value LHS,
const Value RHS,
const Instruction CxtI 
) const
inline

Definition at line 783 of file InstCombineInternal.h.

References llvm::computeOverflowForUnsignedAdd().

◆ computeOverflowForUnsignedMul()

OverflowResult llvm::InstCombiner::computeOverflowForUnsignedMul ( const Value LHS,
const Value RHS,
const Instruction CxtI 
) const
inline

Definition at line 771 of file InstCombineInternal.h.

References llvm::computeOverflowForUnsignedMul().

◆ computeOverflowForUnsignedSub()

OverflowResult llvm::InstCombiner::computeOverflowForUnsignedSub ( const Value LHS,
const Value RHS,
const Instruction CxtI 
) const
inline

Definition at line 795 of file InstCombineInternal.h.

References llvm::computeOverflowForUnsignedSub().

◆ CreateNonTerminatorUnreachable()

void llvm::InstCombiner::CreateNonTerminatorUnreachable ( Instruction InsertAt)
inline

Create and insert the idiom we use to indicate a block is unreachable without having to rewrite the CFG from within InstCombine.

Definition at line 715 of file InstCombineInternal.h.

References llvm::UndefValue::get(), llvm::Value::getContext(), llvm::Type::getInt1PtrTy(), and llvm::ConstantInt::getTrue().

◆ CreateOverflowTuple()

Instruction* llvm::InstCombiner::CreateOverflowTuple ( IntrinsicInst II,
Value Result,
Constant Overflow 
)
inline

Creates a result tuple for an overflow intrinsic II with a given Result and a constant Overflow value.

Definition at line 705 of file InstCombineInternal.h.

References llvm::InsertValueInst::Create(), llvm::ConstantStruct::get(), llvm::UndefValue::get(), llvm::Value::getType(), and llvm::ARM_MB::ST.

◆ dominatesAllUses()

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.

Parameters
DIDefinition
UIUse
DBBlock that must dominate all uses of DI outside the parent block
Returns
true when 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 4859 of file InstCombineCompares.cpp.

References assert(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), and llvm::Value::users().

◆ eraseInstFromFunction()

Instruction* llvm::InstCombiner::eraseInstFromFunction ( Instruction I)
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 728 of file InstCombineInternal.h.

References llvm::InstCombineWorklist::add(), assert(), llvm::dbgs(), llvm::Instruction::eraseFromParent(), LLVM_DEBUG, llvm::User::operands(), llvm::InstCombineWorklist::remove(), llvm::salvageDebugInfo(), and llvm::Value::use_empty().

Referenced by combineLoadToOperationType(), processUGT_ADDCST_ADD(), removeBitcastsFromLoadStoreOnMinMax(), removeTriviallyEmptyRange(), simplifyX86MaskedStore(), and visitAtomicRMWInst().

◆ foldItoFPtoI()

Instruction * InstCombiner::foldItoFPtoI ( CastInst FI)

fpto{s/u}i({u/s}itofp(X)) –> X or zext(X) or sext(X) or trunc(X) This is safe if the intermediate type has enough bits in its mantissa to accurately represent all values of X.

For example, this won't work with i64 -> float -> i64.

Definition at line 1821 of file InstCombineCasts.cpp.

References assert(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), isKnownExactCastIntToFP(), and X.

◆ FoldShiftByConstant()

Instruction * InstCombiner::FoldShiftByConstant ( Value Op0,
Constant Op1,
BinaryOperator I 
)

◆ foldVariableSignZeroExtensionOfVariableHighBitExtract()

Instruction * InstCombiner::foldVariableSignZeroExtensionOfVariableHighBitExtract ( BinaryOperator OldAShr)

◆ getAssumptionCache()

AssumptionCache& llvm::InstCombiner::getAssumptionCache ( ) const
inline

Definition at line 357 of file InstCombineInternal.h.

Referenced by foldCttzCtlz(), and llvm::Negator::Negate().

◆ getDataLayout()

const DataLayout& llvm::InstCombiner::getDataLayout ( ) const
inline

◆ getDominatorTree()

DominatorTree& llvm::InstCombiner::getDominatorTree ( ) const
inline

Definition at line 361 of file InstCombineInternal.h.

Referenced by foldCttzCtlz(), and llvm::Negator::Negate().

◆ getLoopInfo()

LoopInfo* llvm::InstCombiner::getLoopInfo ( ) const
inline

Definition at line 363 of file InstCombineInternal.h.

◆ getTargetLibraryInfo()

TargetLibraryInfo& llvm::InstCombiner::getTargetLibraryInfo ( ) const
inline

Definition at line 365 of file InstCombineInternal.h.

References GEP, I, llvm::ARM_PROC::IE, and SI.

◆ InsertNewInstBefore()

Instruction* llvm::InstCombiner::InsertNewInstBefore ( Instruction New,
Instruction Old 
)
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 650 of file InstCombineInternal.h.

References assert(), llvm::BasicBlock::getInstList(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Instruction::getParent(), llvm::iplist_impl< IntrusiveListT, TraitsT >::insert(), and llvm::InstCombineWorklist::push().

Referenced by simplifyAllocaArraySize().

◆ InsertNewInstWith()

Instruction* llvm::InstCombiner::InsertNewInstWith ( Instruction New,
Instruction Old 
)
inline

Same as InsertNewInstBefore, but also sets the debug loc.

Definition at line 660 of file InstCombineInternal.h.

References llvm::Instruction::getDebugLoc(), and llvm::Instruction::setDebugLoc().

Referenced by replaceExtractElements().

◆ isKnownToBeAPowerOfTwo()

bool llvm::InstCombiner::isKnownToBeAPowerOfTwo ( const Value V,
bool  OrZero = false,
unsigned  Depth = 0,
const Instruction CxtI = nullptr 
)
inline

Definition at line 755 of file InstCombineInternal.h.

References llvm::Depth, and llvm::isKnownToBeAPowerOfTwo().

Referenced by simplifyValueKnownNonZero().

◆ MaskedValueIsZero()

bool llvm::InstCombiner::MaskedValueIsZero ( const Value V,
const APInt Mask,
unsigned  Depth = 0,
const Instruction CxtI = nullptr 
) const
inline

Definition at line 761 of file InstCombineInternal.h.

References llvm::Depth, and llvm::MaskedValueIsZero().

Referenced by canEvaluateShiftedShift().

◆ OptimizePointerDifference()

Value * InstCombiner::OptimizePointerDifference ( Value LHS,
Value RHS,
Type Ty,
bool  IsNUW 
)

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 1603 of file InstCombineAddSub.cpp.

References Builder, llvm::GEPOperator::countNonConstantIndices(), llvm::EmitGEPOffset(), llvm::Instruction::getOpcode(), llvm::Value::hasOneUse(), I, llvm::GEPOperator::isInBounds(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_Instruction(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::match(), and llvm::Instruction::setHasNoUnsignedWrap().

◆ reassociateShiftAmtsOfTwoSameDirectionShifts()

Value * InstCombiner::reassociateShiftAmtsOfTwoSameDirectionShifts ( BinaryOperator Sh0,
const SimplifyQuery SQ,
bool  AnalyzeForSignBitExtraction = false 
)

◆ replacedSelectWithOperand()

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.

Parameters
SISelect instruction
IcmpCompare instruction
SIOpdOperand that replaces the select

Notes:

  • The replacement is global and requires dominator information
  • The caller is responsible for the actual replacement

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 4934 of file InstCombineCompares.cpp.

References assert(), llvm::BitWidth, llvm::APInt::ceilLogBase2(), computeSignedMinMaxValuesFromKnownBits(), computeUnsignedMinMaxValuesFromKnownBits(), llvm::KnownBits::countMinTrailingZeros(), llvm::APInt::countTrailingZeros(), DL, llvm::ConstantInt::get(), llvm::APInt::getActiveBits(), llvm::APInt::getAllOnesValue(), getDemandedBitsLHSMask(), llvm::ConstantInt::getFalse(), llvm::Constant::getIntegerValue(), llvm::CmpInst::getInversePredicate(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::CmpInst::getPredicate(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::BasicBlock::getSinglePredecessor(), llvm::Instruction::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::ConstantInt::getTrue(), llvm::Value::getType(), llvm::ICmpInst::getUnsignedPredicate(), 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, isChainSelectCmpBranch(), llvm::Type::isIntOrIntVectorTy(), llvm::APInt::isNegative(), llvm::APInt::isOneValue(), llvm::APInt::isPowerOf2(), llvm::CmpInst::isSigned(), llvm::KnownBits::isZero(), llvm_unreachable, llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_Power2(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::KnownBits::One, llvm::Value::replaceUsesOutsideBlock(), llvm::APInt::sle(), llvm::APInt::slt(), llvm::APInt::ule(), llvm::APInt::ult(), X, and llvm::KnownBits::Zero.

◆ replaceInstUsesWith()

Instruction* llvm::InstCombiner::replaceInstUsesWith ( Instruction I,
Value V 
)
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 671 of file InstCombineInternal.h.

References llvm::dbgs(), llvm::UndefValue::get(), llvm::Value::getType(), I, LLVM_DEBUG, llvm::InstCombineWorklist::pushUsersToWorkList(), llvm::Value::replaceAllUsesWith(), and llvm::Value::use_empty().

Referenced by foldCtpop(), foldCttzCtlz(), processUGT_ADDCST_ADD(), processUMulZExtIdiom(), removeBitcastsFromLoadStoreOnMinMax(), replaceExtractElements(), simplifyAllocaArraySize(), simplifyX86MaskedLoad(), and unpackLoadToAggregate().

◆ replaceOperand()

Instruction* llvm::InstCombiner::replaceOperand ( Instruction I,
unsigned  OpNum,
Value V 
)
inline

◆ replacePointer()

bool llvm::InstCombiner::replacePointer ( Instruction I,
Value V 
)

Try to replace instruction I with value V which are pointers in different address space.

Returns
true if successful.

◆ replaceUse()

void llvm::InstCombiner::replaceUse ( Use U,
Value NewValue 
)
inline

Replace use and add the previously used value to the worklist.

Definition at line 698 of file InstCombineInternal.h.

References llvm::InstCombineWorklist::addValue().

◆ run()

bool InstCombiner::run ( )

◆ simplifyDivRemOfSelectWithZeroOp()

bool InstCombiner::simplifyDivRemOfSelectWithZeroOp ( BinaryOperator I)

◆ simplifyRangeCheck()

Value * InstCombiner::simplifyRangeCheck ( ICmpInst Cmp0,
ICmpInst Cmp1,
bool  Inverted 
)

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 751 of file InstCombineAndOrXor.cpp.

References Builder, 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().

◆ SliceUpIllegalIntegerPHI()

Instruction * InstCombiner::SliceUpIllegalIntegerPHI ( PHINode FirstPhi)

◆ visitAdd()

Instruction * InstCombiner::visitAdd ( BinaryOperator I)

Definition at line 1201 of file InstCombineAddSub.cpp.

References B, Builder, canonicalizeLowbitMask(), checkForNegativeOperand(), llvm::computeKnownBits(), llvm::SelectInst::Create(), CreateAdd(), llvm::BinaryOperator::CreateNeg(), DL, llvm::dyn_cast(), llvm::MipsISD::Ext, foldNoWrapAdd(), foldToUnsignedSaturatedAdd(), llvm::ConstantInt::get(), llvm::ConstantExpr::getAdd(), llvm::APInt::getBitWidth(), llvm::SelectInst::getCondition(), llvm::SelectInst::getFalseValue(), llvm::APInt::getHighBitsSet(), llvm::Value::getName(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::SelectInst::getTrueValue(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::ConstantExpr::getXor(), 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_Add(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_BinOp(), llvm::PatternMatch::m_c_Add(), llvm::PatternMatch::m_c_And(), llvm::PatternMatch::m_c_BinOp(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Deferred(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_SDiv(), llvm::PatternMatch::m_Shl(), 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(), X, and llvm::KnownBits::Zero.

◆ visitAddrSpaceCast()

Instruction * InstCombiner::visitAddrSpaceCast ( AddrSpaceCastInst CI)

◆ visitAllocaInst()

Instruction * InstCombiner::visitAllocaInst ( AllocaInst AI)

◆ visitAllocSite()

Instruction * InstCombiner::visitAllocSite ( Instruction FI)

◆ visitAnd()

Instruction * InstCombiner::visitAnd ( BinaryOperator I)

Definition at line 1769 of file InstCombineAndOrXor.cpp.

References llvm::MCID::Add, assert(), B, Builder, C, llvm::BinaryOperator::Create(), llvm::SelectInst::Create(), llvm::dyn_cast(), llvm::MipsISD::Ext, foldAndToXor(), llvm::ConstantInt::get(), llvm::ConstantExpr::getAnd(), llvm::APInt::getLowBitsSet(), llvm::Value::getName(), llvm::Constant::getNullValue(), getOpcode(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::ConstantExpr::getTrunc(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::APInt::getZExtValue(), llvm::Value::hasOneUse(), I, llvm::isFreeToInvert(), llvm::APInt::isIntN(), llvm::Type::isIntOrIntVectorTy(), llvm::APInt::isOneValue(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_c_And(), llvm::PatternMatch::m_c_BinOp(), llvm::PatternMatch::m_c_Or(), llvm::PatternMatch::m_c_Xor(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Deferred(), llvm::PatternMatch::m_LogicalShift(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_NSWSub(), llvm::PatternMatch::m_One(), 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_ZExt(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), matchDeMorgansLaws(), llvm::SmallVectorImpl< T >::pop_back_val(), reassociateFCmps(), llvm::recognizeBSwapOrBitReverseIdiom(), llvm::Instruction::removeFromParent(), llvm::SimplifyAndInst(), SimplifyBSwap(), llvm::Value::takeName(), X, Y, and llvm::APInt::zext().

◆ visitAShr()

Instruction * InstCombiner::visitAShr ( BinaryOperator I)

◆ visitAtomicRMWInst()

Instruction * InstCombiner::visitAtomicRMWInst ( AtomicRMWInst SI)

◆ visitBitCast()

Instruction * InstCombiner::visitBitCast ( BitCastInst CI)

◆ visitBranchInst()

Instruction * InstCombiner::visitBranchInst ( BranchInst BI)

◆ visitCallBrInst()

Instruction * InstCombiner::visitCallBrInst ( CallBrInst CBI)

Definition at line 4383 of file InstCombineCalls.cpp.

◆ visitCallInst()

Instruction * InstCombiner::visitCallInst ( CallInst CI)

CallInst simplification.

This mostly only handles folding of intrinsic instructions. For normal calls, it allows visitCallBase to do the heavy lifting.

Definition at line 1850 of file InstCombineCalls.cpp.

References llvm::MCID::Add, llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, llvm::AlwaysOverflowsHigh, llvm::AlwaysOverflowsLow, llvm::Instruction::andIRFlags(), Arg, llvm::AMDGPU::HSAMD::Kernel::Key::Args, assert(), B, llvm::BitWidth, Builder, C, canonicalizeConstantArg0ToArg1(), llvm::computeKnownBits(), Cond, llvm::Constant::containsConstantExpression(), llvm::MCID::Convergent, llvm::APFloat::convert(), llvm::Instruction::copyFastMathFlags(), llvm::Instruction::copyIRFlags(), llvm::BinaryOperator::Create(), llvm::CastInst::Create(), llvm::CallInst::Create(), llvm::SelectInst::Create(), llvm::BinaryOperator::CreateFMulFMF(), llvm::CastInst::CreateIntegerCast(), llvm::BinaryOperator::CreateNSW(), llvm::BinaryOperator::CreateNUW(), llvm::Data, llvm::APFloat::divide(), DL, llvm::Function::doesNotThrow(), llvm::CallBase::doesNotThrow(), llvm::dyn_cast(), 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::ConstantAsMetadata::get(), llvm::VectorType::get(), llvm::ConstantVector::get(), llvm::ConstantPointerNull::get(), llvm::FixedVectorType::get(), llvm::MDString::get(), llvm::MDNode::get(), llvm::UndefValue::get(), llvm::APInt::getAllOnesValue(), llvm::CallBase::getArgOperand(), llvm::BinaryOpIntrinsic::getBinaryOp(), getBitWidth(), llvm::CallBase::getCalledFunction(), llvm::ConstantExpr::getCompare(), llvm::Intrinsic::getDeclaration(), llvm::Instruction::getFastMathFlags(), llvm::Type::getFltSemantics(), llvm::Instruction::getFunction(), llvm::ConstantExpr::getICmp(), llvm::Type::getInt32Ty(), llvm::Type::getIntegerBitWidth(), llvm::ConstantExpr::getIntegerCast(), llvm::IntrinsicInst::getIntrinsicID(), llvm::CmpInst::getInversePredicate(), llvm::getKnownAlignment(), llvm::MemIntrinsicBase< Derived >::getLength(), llvm::BinaryOpIntrinsic::getLHS(), llvm::APInt::getLowBitsSet(), llvm::APSInt::getMaxValue(), llvm::APSInt::getMinValue(), llvm::Instruction::getModule(), llvm::ConstantExpr::getMul(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), getNegativeIsTrueBoolVec(), llvm::Instruction::getNextNonDebugInstruction(), llvm::Constant::getNullValue(), getNumElements(), llvm::APInt::getOneBitSet(), llvm::Instruction::getOpcode(), llvm::getOrEnforceKnownAlignment(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::Type::getPrimitiveSizeInBits(), llvm::APFloat::getQNaN(), llvm::BinaryOpIntrinsic::getRHS(), llvm::Type::getScalarSizeInBits(), llvm::APFloat::getSemantics(), llvm::ConstantExpr::getSExt(), llvm::APInt::getSplat(), llvm::ConstantExpr::getSub(), llvm::CmpInst::getSwappedPredicate(), llvm::BasicBlock::getTerminator(), llvm::ConstantInt::getTrue(), llvm::ConstantInt::getType(), llvm::Value::getType(), llvm::PointerType::getUnqual(), llvm::ConstantExpr::getURem(), llvm::ConstantInt::getZExtValue(), GuardWideningWindow, llvm::Value::hasOneUse(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_UGT, llvm::APFloatBase::IEK_Inf, llvm::APFloatBase::IEK_NaN, llvm::KnownBits::isAllOnes(), llvm::isAssumeWithEmptyBundle(), llvm::APFloat::isDenormal(), llvm::Type::isDoubleTy(), llvm::Instruction::isFast(), llvm::Type::isFloatTy(), llvm::CmpInst::isFPPredicate(), llvm::isFreeCall(), llvm::Type::isHalfTy(), llvm::APFloat::isInfinity(), llvm::Type::isIntegerTy(), llvm::isKnownNeverNaN(), llvm::isKnownNonZero(), llvm::APFloat::isNaN(), llvm::APFloat::isNegative(), llvm::APInt::isNonNegative(), llvm::APFloat::isNormal(), llvm::Constant::isNotMinSignedValue(), llvm::Constant::isNullValue(), llvm::Type::isPointerTy(), llvm::isPowerOf2_32(), llvm::isSafeToSpeculativelyExecute(), llvm::APFloat::isSignaling(), llvm::BinaryOpIntrinsic::isSigned(), llvm::CmpInst::isSigned(), llvm::APInt::isSubsetOf(), llvm::isValidAssumeForContext(), llvm::Type::isVectorTy(), llvm::APFloat::isZero(), llvm::CmpInst::LAST_FCMP_PREDICATE, llvm::CmpInst::LAST_ICMP_PREDICATE, LLVM_FALLTHROUGH, llvm_unreachable, llvm::SPII::Load, llvm::Log2_32_Ceil(), llvm::lowerObjectSizeCall(), llvm::APInt::lshr(), llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APFloat(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_BSwap(), llvm::PatternMatch::m_Cmp(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_FAbs(), llvm::PatternMatch::m_FNeg(), llvm::PatternMatch::m_FPExt(), llvm::PatternMatch::m_FSub(), llvm::PatternMatch::m_ICmp(), llvm::PatternMatch::m_Instruction(), llvm::PatternMatch::m_NaN(), llvm::PatternMatch::m_NegZeroFP(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_NSWAdd(), llvm::PatternMatch::m_NUWAdd(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_PosZeroFP(), llvm::PatternMatch::m_Select(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_SpecificInt(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Undef(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::PatternMatch::m_Zero(), llvm::PatternMatch::m_ZeroInt(), llvm::PatternMatch::m_ZExt(), llvm::PatternMatch::m_ZExtOrSExt(), llvm::CmpInst::makeCmpResultType(), llvm::BitmaskEnumDetail::Mask(), llvm::PatternMatch::match(), llvm::maximum(), llvm::maxnum(), llvm::MayOverflow, llvm::minimum(), llvm::minnum(), llvm::Mod, llvm::Instruction::moveBefore(), llvm::SIInstrFlags::N_INFINITY, llvm::SIInstrFlags::N_NORMAL, llvm::SIInstrFlags::N_SUBNORMAL, llvm::SIInstrFlags::N_ZERO, llvm::NeverOverflows, llvm::None, llvm::FastMathFlags::noSignedZeros(), llvm::ISD::OR, Other, llvm::SIInstrFlags::P_INFINITY, llvm::SIInstrFlags::P_NORMAL, llvm::SIInstrFlags::P_SUBNORMAL, llvm::SIInstrFlags::P_ZERO, llvm::peekThroughBitcast(), llvm::SIInstrFlags::Q_NAN, removeTriviallyEmptyRange(), llvm::AttributeList::ReturnIndex, llvm::NVPTX::PTXCvtMode::RM, llvm::APFloatBase::rmNearestTiesToEven, llvm::APFloatBase::rmTowardZero, round(), llvm::SIInstrFlags::S_NAN, llvm::APInt::sadd_ov(), llvm::scalbn(), llvm::CallBase::setCalledFunction(), llvm::CallBase::setDoesNotThrow(), llvm::Instruction::setMetadata(), SI, llvm::SignBitMustBeZero(), Signed, llvm::SimplifyCall(), llvm::SimplifyFMAFMul(), llvm::SimplifyFMulInst(), simplifyInvariantGroupIntrinsic(), simplifyNeonTbl1(), simplifyNeonVld1(), SimplifyNVVMIntrinsic(), simplifyX86addcarry(), simplifyX86extrq(), simplifyX86immShift(), simplifyX86insertps(), simplifyX86insertq(), simplifyX86MaskedLoad(), simplifyX86MaskedStore(), simplifyX86movmsk(), simplifyX86pack(), simplifyX86pshufb(), simplifyX86varShift(), simplifyX86vpermilvar(), simplifyX86vpermv(), llvm::X86AS::SS, std::swap(), llvm::Value::takeName(), llvm::APInt::uadd_ov(), llvm::APInt::uadd_sat(), llvm::Value::use_empty(), llvm::Align::value(), X, Y, and llvm::APInt::zextOrTrunc().

◆ visitExtractElementInst()

Instruction * InstCombiner::visitExtractElementInst ( ExtractElementInst EI)

◆ visitExtractValueInst()

Instruction * InstCombiner::visitExtractValueInst ( ExtractValueInst EV)

◆ visitFAdd()

Instruction * InstCombiner::visitFAdd ( BinaryOperator I)

◆ visitFCmpInst()

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 6099 of file InstCombineCompares.cpp.

References assert(), B, Builder, C, llvm::APFloat::clearSign(), llvm::APFloat::convert(), llvm::CmpInst::FCMP_OEQ, llvm::CmpInst::FCMP_OGE, llvm::CmpInst::FCMP_OLE, llvm::CmpInst::FCMP_ORD, llvm::CmpInst::FCMP_UGT, llvm::CmpInst::FCMP_ULT, llvm::CmpInst::FCMP_UNE, llvm::CmpInst::FCMP_UNO, llvm::SelectPatternResult::Flavor, foldFabsWithFcmpZero(), foldFCmpReciprocalAndZero(), foldVectorCmp(), llvm::ConstantFP::get(), llvm::getComplexity(), llvm::Instruction::getFastMathFlags(), llvm::Type::getFltSemantics(), llvm::ConstantExpr::getFNeg(), llvm::Constant::getNullValue(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::Instruction::getParent(), llvm::CmpInst::getPredicate(), llvm::Type::getScalarType(), llvm::APFloat::getSmallestNormalized(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::SimplifyQuery::getWithInstruction(), llvm::GlobalVariable::hasDefinitiveInitializer(), llvm::Value::hasOneUse(), I, llvm::GlobalVariable::isConstant(), llvm::isKnownNeverNaN(), llvm::Type::isVectorTy(), isVolatile(), llvm::APFloat::isZero(), llvm::SPII::Load, llvm::PatternMatch::m_AnyZeroFP(), llvm::PatternMatch::m_APFloat(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_FNeg(), llvm::PatternMatch::m_FPExt(), llvm::PatternMatch::m_Instruction(), llvm::PatternMatch::m_PosZeroFP(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), llvm::APFloatBase::rmNearestTiesToEven, llvm::User::setOperand(), llvm::CmpInst::setPredicate(), llvm::SimplifyFCmpInst(), llvm::SPF_UNKNOWN, llvm::FCmpInst::swapOperands(), llvm::Instruction::user_back(), X, and Y.

◆ visitFDiv()

Instruction * InstCombiner::visitFDiv ( BinaryOperator I)

◆ visitFenceInst()

Instruction * InstCombiner::visitFenceInst ( FenceInst FI)

◆ visitFMul()

Instruction * InstCombiner::visitFMul ( BinaryOperator I)

◆ visitFNeg()

Instruction * InstCombiner::visitFNeg ( UnaryOperator I)

◆ visitFPExt()

Instruction * InstCombiner::visitFPExt ( CastInst CI)

◆ visitFPToSI()

Instruction * InstCombiner::visitFPToSI ( FPToSIInst FI)

Definition at line 1868 of file InstCombineCasts.cpp.

References I.

◆ visitFPToUI()

Instruction * InstCombiner::visitFPToUI ( FPToUIInst FI)

Definition at line 1861 of file InstCombineCasts.cpp.

References I.

◆ visitFPTrunc()

Instruction * InstCombiner::visitFPTrunc ( FPTruncInst CI)

◆ visitFree()

Instruction * InstCombiner::visitFree ( CallInst FI)

◆ visitFreeze()

Instruction * InstCombiner::visitFreeze ( FreezeInst I)

◆ visitFRem()

Instruction * InstCombiner::visitFRem ( BinaryOperator I)

◆ visitFSub()

Instruction * InstCombiner::visitFSub ( BinaryOperator I)

◆ visitGetElementPtrInst()

Instruction * InstCombiner::visitGetElementPtrInst ( GetElementPtrInst GEP)

Definition at line 1767 of file InstructionCombining.cpp.

References llvm::GetElementPtrInst::accumulateConstantOffset(), llvm::PHINode::addIncoming(), llvm::SmallVectorImpl< T >::append(), assert(), llvm::BitWidth, Builder, C, llvm::CastInst::Create(), llvm::GetElementPtrInst::Create(), llvm::GetElementPtrInst::CreateInBounds(), llvm::CastInst::CreatePointerBitCastOrAddrSpaceCast(), DL, llvm::dyn_cast(), E, llvm::SmallVectorBase< Size_T >::empty(), F(), foldSelectGEP(), GEP, llvm::gep_type_begin(), llvm::gep_type_end(), llvm::VectorType::get(), llvm::PointerType::getAddressSpace(), llvm::GetElementPtrInst::getAddressSpace(), llvm::APInt::getAllOnesValue(), llvm::Type::getArrayElementType(), llvm::Type::getArrayNumElements(), llvm::PointerType::getElementType(), llvm::BasicBlock::getFirstInsertionPt(), llvm::PHINode::getIncomingBlock(), llvm::generic_gep_type_iterator< ItTy >::getIndexedType(), 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::GetElementPtrInst::getPointerOperandType(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::APInt::getSExtValue(), llvm::GetElementPtrInst::getSourceElementType(), llvm::Value::getType(), llvm::GetElementPtrInst::getTypeAtIndex(), 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(), isMergedGEPInBounds(), 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::PatternMatch::m_Zero(), llvm::makeArrayRef(), llvm::PatternMatch::match(), llvm::User::op_begin(), llvm::User::op_end(), llvm::User::operands(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::GetElementPtrInst::setIsInBounds(), 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.

◆ visitICmpInst()

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 5513 of file InstCombineCompares.cpp.

References llvm::MCID::Add, assert(), B, Builder, C, canonicalizeCmpWithConstant(), canonicalizeICmpBool(), canonicalizeICmpPredicate(), Cond, llvm::APFloat::convertFromAPInt(), llvm::APFloat::convertToInteger(), llvm::CmpInst::Create(), llvm::ExtractValueInst::Create(), DL, 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::SelectPatternResult::Flavor, foldICmpBitCast(), foldICmpOfUAddOv(), foldICmpWithDominatingICmp(), foldICmpWithHighBitMask(), foldICmpWithMinMax(), foldVectorCmp(), llvm::ConstantInt::get(), llvm::Constant::getAllOnesValue(), llvm::IntegerType::getBitWidth(), llvm::getComplexity(), llvm::Type::getFPMantissaWidth(), llvm::ConstantExpr::getFPToSI(), llvm::ConstantExpr::getFPToUI(), llvm::CmpInst::getInversePredicate(), llvm::APFloat::getLargest(), llvm::APInt::getMaxValue(), llvm::APInt::getMinValue(), llvm::Constant::getNullValue(), llvm::Instruction::getOpcode(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::Type::getScalarSizeInBits(), llvm::APFloat::getSemantics(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), llvm::ConstantExpr::getSIToFP(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::ConstantExpr::getUIToFP(), llvm::GetUnderlyingObject(), llvm::SimplifyQuery::getWithInstruction(), 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::APFloatBase::IEK_Inf, llvm::detail::ilogb(), llvm::ICmpInst::isEquality(), llvm::FCmpInst::isEquality(), llvm::Type::isIntOrIntVectorTy(), llvm::isKnownToBeAPowerOfTwo(), llvm::APInt::isMaxSignedValue(), llvm::APInt::isMinSignedValue(), llvm::APFloat::isNaN(), llvm::APFloat::isNegative(), llvm::Type::isPointerTy(), llvm::Type::isVectorTy(), llvm::APFloat::isZero(), llvm_unreachable, llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), 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::matchSelectPattern(), P, processUMulZExtIdiom(), llvm::APFloatBase::rmNearestTiesToEven, llvm::APFloat::roundToIntegral(), llvm::SimplifyICmpInst(), llvm::SPF_UNKNOWN, std::swap(), swapMayExposeCSEOpportunities(), llvm::ICmpInst::swapOperands(), llvm::Instruction::user_back(), and X.

◆ visitInsertElementInst()

Instruction * InstCombiner::visitInsertElementInst ( InsertElementInst IE)

◆ visitInsertValueInst()

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 702 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().

◆ visitInstruction()

Instruction* llvm::InstCombiner::visitInstruction ( Instruction I)
inline

◆ visitIntToPtr()

Instruction * InstCombiner::visitIntToPtr ( IntToPtrInst CI)

◆ visitInvokeInst()

Instruction * InstCombiner::visitInvokeInst ( InvokeInst II)

Definition at line 4378 of file InstCombineCalls.cpp.

◆ visitLandingPadInst()

Instruction * InstCombiner::visitLandingPadInst ( LandingPadInst LI)

◆ visitLoadInst()

Instruction * InstCombiner::visitLoadInst ( LoadInst LI)

◆ visitLShr()

Instruction * InstCombiner::visitLShr ( BinaryOperator I)

◆ visitMul()

Instruction * InstCombiner::visitMul ( BinaryOperator I)

i1 mul -> i1 and.

Definition at line 174 of file InstCombineMulDivRem.cpp.

References llvm::APInt::abs(), assert(), Builder, C, llvm::CastInst::Create(), llvm::SelectInst::Create(), CreateAdd(), CreateMul(), llvm::BinaryOperator::CreateNeg(), llvm::BinaryOperator::CreateWithCopiedFlags(), llvm::dyn_cast(), llvm::MipsISD::Ext, llvm::SelectPatternResult::Flavor, foldMulSelectToNegate(), llvm::ConstantInt::get(), llvm::APInt::getBitWidth(), llvm::Instruction::getFastMathFlags(), getLogBase2(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::ConstantExpr::getShl(), llvm::Value::getType(), hasNoSignedWrap(), 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::PatternMatch::m_Add(), llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_c_Mul(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_FNeg(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Mul(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_One(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Sub(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_ZExt(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), llvm::Instruction::setHasNoSignedWrap(), llvm::Instruction::setHasNoUnsignedWrap(), llvm::SimplifyMulInst(), llvm::SPF_ABS, llvm::SPF_NABS, llvm::Value::takeName(), X, and Y.

◆ visitOr()

Instruction * InstCombiner::visitOr ( BinaryOperator I)

◆ visitPHINode()

Instruction * InstCombiner::visitPHINode ( PHINode PN)

◆ visitPtrToInt()

Instruction * InstCombiner::visitPtrToInt ( PtrToIntInst CI)

◆ visitReturnInst()

Instruction * InstCombiner::visitReturnInst ( ReturnInst RI)

◆ visitSDiv()

Instruction * InstCombiner::visitSDiv ( BinaryOperator I)

◆ visitSelectInst()

Instruction* llvm::InstCombiner::visitSelectInst ( SelectInst SI)

◆ visitSExt()

Instruction * InstCombiner::visitSExt ( SExtInst CI)

◆ visitShl()

Instruction * InstCombiner::visitShl ( BinaryOperator I)

◆ visitShuffleVectorInst()

Instruction * InstCombiner::visitShuffleVectorInst ( ShuffleVectorInst SVI)

Definition at line 1977 of file InstCombineVectorOps.cpp.

References assert(), Builder, canEvaluateShuffled(), canonicalizeInsertSplat(), llvm::SmallVectorImpl< T >::clear(), llvm::ShuffleVectorInst::commute(), llvm::CastInst::Create(), DL, llvm::dyn_cast(), llvm::numbers::e, E, llvm::SmallVectorBase< SmallVectorSizeType< T > >::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), evaluateInDifferentElementOrder(), llvm::MipsISD::Ext, llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), foldIdentityExtractShuffle(), foldIdentityPaddedShuffles(), foldSelectShuffle(), foldShuffleWithInsert(), foldTruncShuffle(), llvm::ArrayRef< T >::front(), llvm::ConstantInt::get(), llvm::ConstantVector::get(), llvm::FixedVectorType::get(), llvm::UndefValue::get(), llvm::APInt::getAllOnesValue(), llvm::Value::getContext(), llvm::VectorType::getElementType(), llvm::TypeSize::getFixedSize(), llvm::Type::getInt32Ty(), llvm::Value::getName(), llvm::VectorType::getNumElements(), getNumElements(), llvm::User::getOperand(), llvm::Type::getPrimitiveSizeInBits(), llvm::ShuffleVectorInst::getShuffleMask(), llvm::Value::getType(), llvm::ShuffleVectorInst::getType(), llvm::SimplifyQuery::getWithInstruction(), I, Int32Ty, isShuffleExtractingFromLHS(), isSplat(), llvm::VectorType::isValidElementType(), llvm::PatternMatch::m_BitCast(), llvm::PatternMatch::m_Undef(), llvm::PatternMatch::m_Value(), llvm::BitmaskEnumDetail::Mask(), llvm::PatternMatch::match(), llvm::narrowShuffleMaskElts(), narrowVectorSelect(), llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SimplifyShuffleVectorInst(), llvm::SmallVectorBase< SmallVectorSizeType< T > >::size(), llvm::ArrayRef< T >::size(), llvm::UndefMaskElem, llvm::Value::users(), llvm::widenShuffleMaskElts(), and X.

◆ visitSIToFP()

Instruction * InstCombiner::visitSIToFP ( CastInst CI)

Definition at line 1879 of file InstCombineCasts.cpp.

◆ visitSRem()

Instruction * InstCombiner::visitSRem ( BinaryOperator I)

◆ visitStoreInst()

Instruction * InstCombiner::visitStoreInst ( StoreInst SI)

◆ visitSub()

Instruction * InstCombiner::visitSub ( BinaryOperator I)

Definition at line 1695 of file InstCombineAddSub.cpp.

References llvm::AddOne(), assert(), B, Builder, C, llvm::computeKnownBits(), Cond, llvm::Instruction::copyMetadata(), llvm::SelectInst::Create(), CreateAdd(), llvm::BinaryOperator::CreateNeg(), llvm::BinaryOperator::CreateNot(), llvm::dyn_cast(), llvm::MipsISD::Ext, llvm::SelectPatternResult::Flavor, llvm::Constant::getAllOnesValue(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::ConstantExpr::getSub(), llvm::Value::getType(), llvm::Instruction::hasNoSignedWrap(), llvm::Instruction::hasNoUnsignedWrap(), llvm::Value::hasNUsesOrMore(), I, llvm::isFreeToInvert(), llvm::Type::isIntOrIntVectorTy(), llvm::APInt::isMask(), llvm::SelectPatternResult::isMinOrMax(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_c_Add(), llvm::PatternMatch::m_c_And(), llvm::PatternMatch::m_c_Or(), llvm::PatternMatch::m_c_Xor(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_Neg(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_PtrToInt(), llvm::PatternMatch::m_Select(), llvm::PatternMatch::m_SExt(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Sub(), llvm::PatternMatch::m_Trunc(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::PatternMatch::m_ZeroInt(), llvm::PatternMatch::m_ZExt(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), llvm::Negator::Negate(), llvm::none_of(), llvm::MCID::Select, llvm::Instruction::setHasNoSignedWrap(), llvm::Instruction::setHasNoUnsignedWrap(), SI, llvm::SimplifySubInst(), llvm::SubOne(), std::swap(), llvm::Value::users(), X, Y, and llvm::KnownBits::Zero.

◆ visitSwitchInst()

Instruction * InstCombiner::visitSwitchInst ( SwitchInst SI)

◆ visitTrunc()

Instruction * InstCombiner::visitTrunc ( TruncInst CI)

Definition at line 690 of file InstCombineCasts.cpp.

References assert(), Builder, C, canEvaluateTruncated(), llvm::computeKnownBits(), llvm::APInt::countPopulation(), llvm::APInt::countTrailingZeros(), llvm::BinaryOperator::Create(), llvm::ExtractElementInst::Create(), llvm::CastInst::CreateIntegerCast(), llvm::dbgs(), DL, foldVecTruncToExtElt(), llvm::ConstantInt::get(), llvm::FixedVectorType::get(), llvm::Value::getName(), llvm::Constant::getNullValue(), llvm::User::getOperand(), llvm::ConstantExpr::getOr(), llvm::CmpInst::getPredicate(), llvm::Type::getPrimitiveSizeInBits(), llvm::Type::getScalarSizeInBits(), llvm::ConstantExpr::getShl(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::ConstantInt::getZExtValue(), llvm::APInt::getZExtValue(), llvm::Value::hasOneUse(), I, llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_SGT, llvm::CmpInst::ICMP_SLT, llvm::tgtok::In, llvm::APInt::isAllOnesValue(), llvm::ICmpInst::isEquality(), llvm::Type::isIntegerTy(), llvm::APInt::isNullValue(), llvm::APInt::isPowerOf2(), llvm::Type::isVectorTy(), LLVM_DEBUG, llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_c_Or(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Deferred(), llvm::PatternMatch::m_ExtractElt(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_OneUse(), 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(), llvm::min(), llvm::KnownBits::One, shrinkInsertElt(), shrinkSplatShuffle(), llvm::SPF_UNKNOWN, llvm::Value::takeName(), llvm::APInt::trunc(), llvm::APInt::uge(), llvm::APInt::ult(), X, and llvm::KnownBits::Zero.

◆ visitUDiv()

Instruction * InstCombiner::visitUDiv ( BinaryOperator I)

◆ visitUIToFP()

Instruction * InstCombiner::visitUIToFP ( CastInst CI)

Definition at line 1875 of file InstCombineCasts.cpp.

◆ visitURem()

Instruction * InstCombiner::visitURem ( BinaryOperator I)

◆ visitVAEndInst()

Instruction * InstCombiner::visitVAEndInst ( VAEndInst I)

◆ visitXor()

Instruction * InstCombiner::visitXor ( BinaryOperator I)

Definition at line 3104 of file InstCombineAndOrXor.cpp.

References llvm::MCID::Add, llvm::AddOne(), B, Builder, C, llvm::SelectInst::Create(), CreateAdd(), llvm::BinaryOperator::CreateNot(), llvm::dyn_cast(), llvm::SelectPatternResult::Flavor, foldXorToXor(), llvm::ConstantInt::get(), llvm::Constant::getAllOnesValue(), llvm::Instruction::getDebugLoc(), llvm::getInverseMinMaxPred(), llvm::CmpInst::getInversePredicate(), llvm::Value::getName(), llvm::ConstantExpr::getNeg(), llvm::ConstantExpr::getNot(), llvm::Constant::getNullValue(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::Type::getScalarSizeInBits(), llvm::Type::getScalarType(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::Value::hasNUses(), llvm::Value::hasNUsesOrMore(), llvm::Value::hasOneUse(), I, llvm::isFreeToInvert(), llvm::SelectPatternResult::isMinOrMax(), llvm::APInt::isSignMask(), llvm::APInt::lshr(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_AllOnes(), llvm::PatternMatch::m_And(), llvm::PatternMatch::m_APInt(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_BinOp(), llvm::PatternMatch::m_c_Add(), llvm::PatternMatch::m_c_And(), llvm::PatternMatch::m_c_Or(), llvm::PatternMatch::m_c_Xor(), llvm::PatternMatch::m_Cmp(), llvm::PatternMatch::m_Constant(), llvm::PatternMatch::m_Deferred(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Negative(), llvm::PatternMatch::m_NonNegative(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_OneUse(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::m_Sub(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::MaskedValueIsZero(), llvm::PatternMatch::match(), llvm::matchSelectPattern(), llvm::Constant::replaceUndefsWith(), llvm::CmpInst::setPredicate(), SimplifyBSwap(), llvm::SimplifyXorInst(), sinkNotIntoXor(), std::swap(), llvm::Value::takeName(), visitMaskedMerge(), X, and Y.

◆ visitZExt()

Instruction * InstCombiner::visitZExt ( ZExtInst CI)

Member Data Documentation

◆ Builder

BuilderTy& llvm::InstCombiner::Builder

◆ MaxArraySizeForCombine

uint64_t llvm::InstCombiner::MaxArraySizeForCombine = 0

Maximum size of array considered when transforming.

Definition at line 811 of file InstCombineInternal.h.

Referenced by combineInstructionsOverFunction(), unpackLoadToAggregate(), and unpackStoreToAggregate().

◆ Worklist

InstCombineWorklist& llvm::InstCombiner::Worklist

A worklist of the instructions that need to be simplified.

Definition at line 313 of file InstCombineInternal.h.

Referenced by getShiftedValue(), and processUMulZExtIdiom().


The documentation for this class was generated from the following files: