10 #ifndef INSTCOMBINE_INSTCOMBINE_H
11 #define INSTCOMBINE_INSTCOMBINE_H
26 class TargetLibraryInfo;
43 if (isa<Instruction>(V)) {
50 if (isa<Argument>(V))
return 3;
51 return isa<Constant>(V) ? (isa<UndefValue>(V) ? 0 : 1) : 2;
98 bool DoOneIteration(
Function &
F,
unsigned ItNum);
213 bool ShouldChangeType(
Type *From,
Type *To)
const;
215 Value *dyn_castFNegVal(
Value *V,
bool NoSignedZero=
false)
const;
216 Type *FindElementAtOffset(
Type *PtrTy, int64_t Offset,
229 bool transformConstExprCastCall(
CallSite CS);
233 bool DoXform =
true);
235 bool WillNotOverflowSignedAdd(
Value *LHS,
Value *RHS);
246 "New instruction already inserted into a basic block!");
258 return InsertNewInstBefore(New, Old);
268 Worklist.AddUsersToWorkList(I);
275 DEBUG(
dbgs() <<
"IC: Replacing " << I <<
"\n"
276 " with " << *V <<
'\n');
287 DEBUG(
dbgs() <<
"IC: ERASE " << I <<
'\n');
289 assert(I.
use_empty() &&
"Cannot erase instruction that is used!");
304 APInt &KnownOne,
unsigned Depth = 0)
const {
309 unsigned Depth = 0)
const {
334 bool SimplifyDemandedBits(
Use &U,
APInt DemandedMask,
346 bool SimplifyDemandedInstructionBits(
Instruction &Inst);
349 APInt& UndefElts,
unsigned Depth = 0);
373 bool isSigned,
bool Inside);
376 bool SimplifyStoreAtEndOfBlock(
StoreInst &SI);
381 Value *EvaluateInDifferentType(
Value *V,
Type *Ty,
bool isSigned);
IRBuilder< true, TargetFolder, InstCombineIRInserter > BuilderTy
Instruction * InsertNewInstWith(Instruction *New, Instruction &Old)
Abstract base class of comparison instructions.
void initializeInstCombinerPass(PassRegistry &)
static PassRegistry * getPassRegistry()
Base class for instruction visitors.
This class represents zero extension of integer types.
unsigned getNumOperands() const
bool MaskedValueIsZero(Value *V, const APInt &Mask, const DataLayout *TD=0, unsigned Depth=0)
Value * EmitGEPOffset(IRBuilderTy *Builder, const DataLayout &TD, User *GEP, bool NoAssumptions=false)
This class represents a sign extension of integer types.
void setDebugLoc(const DebugLoc &Loc)
setDebugLoc - Set the debug location information for this instruction.
LoopInfoBase< BlockT, LoopT > * LI
This class represents a conversion between pointers from one address space to another.
static unsigned getComplexity(Value *V)
DataLayout * getDataLayout() const
unsigned ComputeNumSignBits(Value *Op, unsigned Depth=0) const
Base class of casting instructions.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
InstCombiner - The -instcombine pass.
ID
LLVM Calling Convention Representation.
This class represents a cast from a pointer to an integer.
Represents a floating point comparison operator.
This class represents a no-op cast from one type to another.
Instruction * visitInstruction(Instruction &I)
void replaceAllUsesWith(Value *V)
This class represents a cast from floating point to signed integer.
This class represents a truncation of integer types.
void ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne, const DataLayout *TD=0, unsigned Depth=0)
LLVM Basic Block Representation.
LLVM Constant Representation.
Instruction * ReplaceInstUsesWith(Instruction &I, Value *V)
void ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne, unsigned Depth=0) const
void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB, BasicBlock::iterator InsertPt) const
const DebugLoc & getDebugLoc() const
getDebugLoc - Return the debug location for this node as a DebugLoc.
const InstListType & getInstList() const
Return the underlying instruction list container.
Represent an integer comparison operator.
iterator insert(iterator where, NodeTy *New)
#define LLVM_LIBRARY_VISIBILITY
static bool isNot(const Value *V)
InstCombineWorklist Worklist
Worklist - All of the instructions that need to be simplified.
This class represents a cast from an integer to a pointer.
static UndefValue * get(Type *T)
This provides the default implementation of the IRBuilder 'InsertHelper' method that is called whenev...
Class for constant integers.
This class represents a cast from floating point to unsigned integer.
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
static bool isNeg(const Value *V)
Class for arbitrary precision integers.
TargetLibraryInfo * getTargetLibraryInfo() const
void InsertHelper(Instruction *I, const Twine &Name, BasicBlock *BB, BasicBlock::iterator InsertPt) const
static bool isFNeg(const Value *V, bool IgnoreZeroSign=false)
Instruction * InsertNewInstBefore(Instruction *New, Instruction &Old)
unsigned ComputeNumSignBits(Value *Op, const DataLayout *TD=0, unsigned Depth=0)
bool MaskedValueIsZero(Value *V, const APInt &Mask, unsigned Depth=0) const
This class represents a truncation of floating point types.
LLVM Value Representation.
Instruction * EraseInstFromFunction(Instruction &I)
InstCombineIRInserter(InstCombineWorklist &WL)
static RegisterPass< NVPTXAllocaHoisting > X("alloca-hoisting","Hoisting alloca instructions in non-entry ""blocks to the entry block")
const BasicBlock * getParent() const
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD