LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
ValueTracking.cpp File Reference
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Operator.h"
#include "llvm/Support/ConstantRange.h"
#include "llvm/Support/GetElementPtrTypeIterator.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/PatternMatch.h"
#include <cstring>
Include dependency graph for ValueTracking.cpp:

Go to the source code of this file.

Functions

static unsigned getBitWidth (Type *Ty, const DataLayout *TD)
 
static void ComputeMaskedBitsAddSub (bool Add, Value *Op0, Value *Op1, bool NSW, APInt &KnownZero, APInt &KnownOne, APInt &KnownZero2, APInt &KnownOne2, const DataLayout *TD, unsigned Depth)
 
static void ComputeMaskedBitsMul (Value *Op0, Value *Op1, bool NSW, APInt &KnownZero, APInt &KnownOne, APInt &KnownZero2, APInt &KnownOne2, const DataLayout *TD, unsigned Depth)
 
static bool isGEPKnownNonNull (GEPOperator *GEP, const DataLayout *DL, unsigned Depth)
 Test whether a GEP's result is known to be non-null. More...
 
static ValueBuildSubAggregate (Value *From, Value *To, Type *IndexedType, SmallVectorImpl< unsigned > &Idxs, unsigned IdxSkip, Instruction *InsertBefore)
 
static ValueBuildSubAggregate (Value *From, ArrayRef< unsigned > idx_range, Instruction *InsertBefore)
 
static uint64_t GetStringLengthH (Value *V, SmallPtrSet< PHINode *, 32 > &PHIs)
 

Variables

const unsigned MaxDepth = 6
 

Function Documentation

static Value* BuildSubAggregate ( Value From,
Value To,
Type IndexedType,
SmallVectorImpl< unsigned > &  Idxs,
unsigned  IdxSkip,
Instruction InsertBefore 
)
static
static Value* BuildSubAggregate ( Value From,
ArrayRef< unsigned idx_range,
Instruction InsertBefore 
)
static
static void ComputeMaskedBitsAddSub ( bool  Add,
Value Op0,
Value Op1,
bool  NSW,
APInt KnownZero,
APInt KnownOne,
APInt KnownZero2,
APInt KnownOne2,
const DataLayout TD,
unsigned  Depth 
)
static
static void ComputeMaskedBitsMul ( Value Op0,
Value Op1,
bool  NSW,
APInt KnownZero,
APInt KnownOne,
APInt KnownZero2,
APInt KnownOne2,
const DataLayout TD,
unsigned  Depth 
)
static
static unsigned getBitWidth ( Type Ty,
const DataLayout TD 
)
static
static uint64_t GetStringLengthH ( Value V,
SmallPtrSet< PHINode *, 32 > &  PHIs 
)
static

GetStringLengthH - If we can compute the length of the string pointed to by the specified pointer, return 'len+1'. If we can't, return 0.

Definition at line 1839 of file ValueTracking.cpp.

References llvm::getConstantStringInfo(), llvm::SmallPtrSet< PtrType, SmallSize >::insert(), llvm::StringRef::size(), and llvm::Value::stripPointerCasts().

Referenced by llvm::GetStringLength().

static bool isGEPKnownNonNull ( GEPOperator GEP,
const DataLayout DL,
unsigned  Depth 
)
static

Test whether a GEP's result is known to be non-null.

Uses properties inherent in a GEP to try to determine whether it is known to be non-null.

Currently this routine does not support vector GEPs.

Definition at line 916 of file ValueTracking.cpp.

References llvm::gep_type_begin(), llvm::gep_type_end(), llvm::StructLayout::getElementOffset(), llvm::GEPOperator::getPointerAddressSpace(), llvm::GEPOperator::getPointerOperand(), llvm::DataLayout::getStructLayout(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::ConstantInt::getZExtValue(), llvm::GEPOperator::isInBounds(), llvm::isKnownNonZero(), llvm::Type::isPointerTy(), and MaxDepth.

Referenced by llvm::isKnownNonZero().

Variable Documentation

const unsigned MaxDepth = 6