|
LLVM
4.0.0
|
#include "llvm/Analysis/LazyValueInfo.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/STLExtras.h"#include "llvm/Analysis/AssumptionCache.h"#include "llvm/Analysis/ConstantFolding.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/IR/CFG.h"#include "llvm/IR/ConstantRange.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/PatternMatch.h"#include "llvm/IR/ValueHandle.h"#include "llvm/Support/Debug.h"#include "llvm/Support/raw_ostream.h"#include <map>#include <stack>Go to the source code of this file.
Namespaces | |
| llvm | |
| Compute iterated dominance frontiers using a linear time algorithm. | |
Macros | |
| #define | DEBUG_TYPE "lazy-value-info" |
Functions | |
| INITIALIZE_PASS_BEGIN (LazyValueInfoWrapperPass,"lazy-value-info","Lazy Value Information Analysis", false, true) INITIALIZE_PASS_END(LazyValueInfoWrapperPass | |
| FunctionPass * | llvm::createLazyValueInfoPass () |
| createLazyValueInfoPass - This creates an instance of the LazyValueInfo pass. More... | |
| raw_ostream & | llvm::operator<< (raw_ostream &OS, const LVILatticeVal &Val) LLVM_ATTRIBUTE_USED |
| static bool | hasSingleValue (const LVILatticeVal &Val) |
| Returns true if this lattice value represents at most one possible value. More... | |
| static LVILatticeVal | intersect (LVILatticeVal A, LVILatticeVal B) |
| Combine two sets of facts about the same value into a single set of facts. More... | |
| static LVILatticeVal | getFromRangeMetadata (Instruction *BBI) |
| static bool | InstructionDereferencesPointer (Instruction *I, Value *Ptr) |
| static bool | isObjectDereferencedInBlock (Value *Val, BasicBlock *BB) |
| Return true if the allocation associated with Val is ever dereferenced within the given basic block. More... | |
| static LVILatticeVal | getValueFromCondition (Value *Val, Value *Cond, bool isTrueDest=true) |
| static LVILatticeVal | getValueFromICmpCondition (Value *Val, ICmpInst *ICI, bool isTrueDest) |
| static LVILatticeVal | getValueFromCondition (Value *Val, Value *Cond, bool isTrueDest, DenseMap< Value *, LVILatticeVal > &Visited) |
| static LVILatticeVal | getValueFromConditionImpl (Value *Val, Value *Cond, bool isTrueDest, DenseMap< Value *, LVILatticeVal > &Visited) |
| static bool | getEdgeValueLocal (Value *Val, BasicBlock *BBFrom, BasicBlock *BBTo, LVILatticeVal &Result) |
| Compute the value of Val on the edge BBFrom -> BBTo. More... | |
| static LazyValueInfoImpl & | getImpl (void *&PImpl, AssumptionCache *AC, const DataLayout *DL, DominatorTree *DT=nullptr) |
| This lazily constructs the LazyValueInfoImpl. More... | |
| static bool | isKnownNonConstant (Value *V) |
| Returns true if we can statically tell that this value will never be a "useful" constant. More... | |
| static LazyValueInfo::Tristate | getPredicateResult (unsigned Pred, Constant *C, LVILatticeVal &Result, const DataLayout &DL, TargetLibraryInfo *TLI) |
Variables | |
| lazy value | info |
| lazy value Lazy Value Information | Analysis |
| lazy value Lazy Value Information | false |
| #define DEBUG_TYPE "lazy-value-info" |
Definition at line 40 of file LazyValueInfo.cpp.
|
static |
Compute the value of Val on the edge BBFrom -> BBTo.
Returns false if Val is not constrained on the edge. Result is unspecified if return value is false.
Definition at line 1297 of file LazyValueInfo.cpp.
References assert(), llvm::ConstantRange::difference(), llvm::ConstantInt::get(), llvm::SelectInst::getCondition(), llvm::Value::getContext(), llvm::Type::getInt1Ty(), llvm::Type::getIntegerBitWidth(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), getValueFromCondition(), i, and llvm::ConstantRange::unionWith().
|
static |
Definition at line 687 of file LazyValueInfo.cpp.
References llvm::Call, llvm::getConstantRangeFromMetadata(), llvm::Instruction::getMetadata(), llvm::Instruction::getOpcode(), llvm::Value::getType(), llvm::SPII::Load, and llvm::LLVMContext::MD_range.
|
static |
This lazily constructs the LazyValueInfoImpl.
Definition at line 1462 of file LazyValueInfo.cpp.
References assert().
Referenced by llvm::LazyValueInfo::eraseBlock(), llvm::AttributeSet::get(), llvm::MDTuple::get(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::MDTuple::getDistinct(), llvm::MDTuple::getIfExists(), llvm::LazyValueInfo::getPredicateAt(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::MDTuple::getTemporary(), llvm::LazyValueInfo::releaseMemory(), llvm::LazyValueInfoWrapperPass::runOnFunction(), and llvm::LazyValueInfo::threadEdge().
|
static |
Definition at line 1587 of file LazyValueInfo.cpp.
References C, llvm::ConstantFoldCompareInstOperands(), llvm::ConstantRange::contains(), llvm::dyn_cast(), llvm::LazyValueInfo::False, llvm::ConstantInt::getValue(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::ConstantRange::inverse(), llvm::Constant::isNullValue(), llvm::ConstantRange::isSingleElement(), llvm::ConstantRange::makeExactICmpRegion(), llvm::LazyValueInfo::True, and llvm::LazyValueInfo::Unknown.
Referenced by llvm::LazyValueInfo::getPredicateAt(), and llvm::LazyValueInfo::getPredicateOnEdge().
Definition at line 1288 of file LazyValueInfo.cpp.
References assert().
Referenced by getEdgeValueLocal(), and getValueFromConditionImpl().
|
static |
Definition at line 1277 of file LazyValueInfo.cpp.
References llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), and getValueFromConditionImpl().
|
static |
Definition at line 1257 of file LazyValueInfo.cpp.
References llvm::APIntOps::And(), llvm::dyn_cast(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), getValueFromCondition(), getValueFromICmpCondition(), and intersect().
Referenced by getValueFromCondition().
|
static |
Definition at line 1189 of file LazyValueInfo.cpp.
References llvm::getConstantRangeFromMetadata(), llvm::Type::getIntegerBitWidth(), llvm::CmpInst::getInversePredicate(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::CmpInst::ICMP_EQ, llvm::ICmpInst::isEquality(), llvm::Type::isIntegerTy(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Specific(), llvm::ConstantRange::makeAllowedICmpRegion(), llvm::PatternMatch::match(), llvm::LLVMContext::MD_range, Offset, llvm::ConstantRange::subtract(), and std::swap().
Referenced by getValueFromConditionImpl().
Returns true if this lattice value represents at most one possible value.
This is as precise as any lattice value can get while still representing reachable code.
Definition at line 274 of file LazyValueInfo.cpp.
Referenced by intersect().
| INITIALIZE_PASS_BEGIN | ( | LazyValueInfoWrapperPass | , |
| "lazy-value-info" | , | ||
| "Lazy Value Information Analysis" | , | ||
| false | , | ||
| true | |||
| ) |
|
static |
Definition at line 771 of file LazyValueInfo.cpp.
References llvm::dyn_cast(), llvm::GetUnderlyingObject(), llvm::ConstantInt::isZero(), L, and MI.
Referenced by isObjectDereferencedInBlock().
|
static |
Combine two sets of facts about the same value into a single set of facts.
Note that this method is not suitable for merging facts along different paths in a CFG; that's what the mergeIn function is for. This is for merging facts gathered about the same value at the same location through two independent means. Notes:
Definition at line 299 of file LazyValueInfo.cpp.
References A, and hasSingleValue().
Referenced by getValueFromConditionImpl().
Returns true if we can statically tell that this value will never be a "useful" constant.
In practice, this means we've got something like an alloca or a malloc call for which a comparison against a constant can only be guarding dead code. Note that we are potentially giving up some precision in dead code (a constant result) in favour of avoiding a expensive search for a easily answered common query.
Definition at line 1522 of file LazyValueInfo.cpp.
References llvm::Value::stripPointerCasts().
Referenced by llvm::LazyValueInfo::getConstant().
|
static |
Return true if the allocation associated with Val is ever dereferenced within the given basic block.
This establishes the fact Val is not null, but does not imply that the memory at Val is dereferenceable. (Val may point off the end of the dereferenceable part of the object.)
Definition at line 806 of file LazyValueInfo.cpp.
References assert(), llvm::Module::getDataLayout(), llvm::BasicBlock::getModule(), llvm::Value::getType(), llvm::GetUnderlyingObject(), InstructionDereferencesPointer(), and llvm::Type::isPointerTy().
| lazy value Lazy Value Information Analysis |
Definition at line 47 of file LazyValueInfo.cpp.
| lazy value Lazy Value Information false |
Definition at line 47 of file LazyValueInfo.cpp.
| lazy value info |
Definition at line 47 of file LazyValueInfo.cpp.
Referenced by findLiveReferences(), llvm::CCState::getInRegsParamInfo(), insertParsePoints(), and recomputeLiveInValues().
1.8.6