llvm::InstCombiner

The core instruction combiner logic.

Synopsis

Declared in <llvm/Transforms/InstCombine/InstCombiner.h>

class InstCombiner;

Description

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

Type Aliases

NameDescription
BuilderTy An IRBuilder that automatically inserts new instructions into the worklist.

Member Functions

NameDescription
InstCombiner [constructor]Construct an instruction combiner for F with the given analyses.
~InstCombiner [destructor] [virtual]Destroy the instruction combiner.
ComputeMaxSignificantBits Compute an upper bound on significant bits needed for Op.
ComputeNumSignBits Compute the number of known sign bits of Op.
InsertNewInstBefore Inserts an instruction New before instruction Old
InsertNewInstWith Same as InsertNewInstBefore, but also sets the debug loc.
MaskedValueIsZero Return true if V masked by Mask is known to be zero.
SimplifyDemandedBits Simplify operand OpNo of I based on demanded bits.
SimplifyDemandedVectorElts [virtual]Simplify V based on which vector elements are demanded.
addToWorklist Add I to the combiner worklist.
canBeCastedExactlyIntToFP Return true if V can be cast exactly to floating-point type FPTy.
canFreelyInvertAllUsersOf Return true if every user of i1 V can adapt to !V for free.
computeBackEdges Compute the set of backedges in the function.
computeKnownBits computeKnownBits overloads
computeOverflowForSignedAdd Compute whether a signed add of LHS and RHS can overflow.
computeOverflowForSignedMul Compute whether a signed multiply of LHS and RHS can overflow.
computeOverflowForSignedSub Compute whether a signed subtract of LHS and RHS can overflow.
computeOverflowForUnsignedAdd Compute whether an unsigned add of LHS and RHS can overflow.
computeOverflowForUnsignedMul Compute whether an unsigned multiply of LHS and RHS can overflow.
computeOverflowForUnsignedSub Compute whether an unsigned subtract of LHS and RHS can overflow.
eraseInstFromFunction [virtual]Combiner aware instruction erasure.
getAssumptionCache Return the assumption cache used by this combiner.
getBlockFrequencyInfo Return optional block-frequency information, or null if unavailable.
getDataLayout Return the data layout used by this combiner.
getDominatorTree Return the dominator tree used by this combiner.
getFreelyInverted Return a freely inverted form of V, or null if none exists.
getFreelyInvertedImpl Return a freely inverted form of V, or null if none exists.
getOptimizationRemarkEmitter Return the optimization-remark emitter used by this combiner.
getProfileSummaryInfo Return optional profile-summary information, or null if unavailable.
getSimplifyQuery Return the simplify query used by this combiner.
getTargetLibraryInfo Return the target library information used by this combiner.
isBackEdge Return true if the edge from From to To is a backedge.
isFreeToInvert isFreeToInvert overloads
isKnownExactCastIntToFP Return true if the cast from integer to FP can be proven to be exact for all possible inputs (the conversion does not lose any precision).
isKnownToBeAPowerOfTwo Return true if V is known to be a power of two (or zero).
isValidAddrSpaceCast Return true if casting from address space FromAS to ToAS is valid.
replaceInstUsesWith A combiner-aware RAUW-like routine.
replaceOperand Replace operand of instruction and add old operand to the worklist.
replaceUse Replace use and add the previously used value to the worklist.
targetInstCombineIntrinsic Attempt a target-specific combine of intrinsic II.
targetSimplifyDemandedUseBitsIntrinsic Simplify demanded bits of a target-specific intrinsic use.
targetSimplifyDemandedVectorEltsIntrinsic Simplify demanded vector elements of a target-specific intrinsic.

Static Member Functions

NameDescription
AddOne Add one to a Constant
SubOne Subtract one from a Constant
getComplexity Assign a complexity rank to V for canonicalization.
getSafeVectorConstantForBinop Some binary operators require special handling to avoid poison and undefined behavior.
isCanonicalPredicate Predicate canonicalization reduces the number of patterns that need to be matched by other transforms.
peekThroughBitcast Return the source of a bitcast, or V if there is none.
shouldAvoidAbsorbingNotIntoSelect Return true if absorbing a not into SI would break canonical form.
stripSignOnlyFPOps Ignore all operations which only change the sign of a value, returning the underlying magnitude value.

Data Members

NameDescription
Builder IR builder that inserts new instructions and adds them to the worklist.
MaxArraySizeForCombine Maximum size of array considered when transforming.

Protected Data Members

NameDescription
AA Optional alias-analysis results used by some combines.
AC The assumption cache for the function.
AnnotationMetadataSource Source for annotation metadata, used by the IRBuilder inserter.
BFI Optional block-frequency information for profile-guided combines.
BPI Optional branch-probability information for profile-guided combines.
BackEdges Backedges, used to avoid pushing instructions across backedges in cases.
ComputedBackEdges Whether BackEdges has already been computed for this function.
DC Cache of dominating conditions used to refine known bits.
DL The data layout for the module or function.
DT The dominator tree for the function.
DeadEdges Edges that are known to never be taken.
F The function being simplified by the combiner.
MadeIRChange Whether this combiner instance has modified the IR.
MinimizeSize Whether the combiner is running in minimize-size mode.
ORE Emitter for optimization remarks produced by the combiner.
PSI Optional profile-summary information for profile-guided combines.
PredOrder Order of predecessors to canonicalize phi nodes towards.
RPOT Reverse post-order traversal of the function's basic blocks.
SQ Simplify query bundling analyses used by value-tracking helpers.
TLI Target library information for recognized libcalls.
Worklist A worklist of the instructions that need to be simplified.