|
LLVM
10.0.0
|
#include "llvm/Analysis/LazyValueInfo.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/Optional.h"#include "llvm/ADT/STLExtras.h"#include "llvm/Analysis/AssumptionCache.h"#include "llvm/Analysis/ConstantFolding.h"#include "llvm/Analysis/InstructionSimplify.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/Analysis/ValueLattice.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/IR/AssemblyAnnotationWriter.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/InitializePasses.h"#include "llvm/Support/Debug.h"#include "llvm/Support/FormattedStream.h"#include "llvm/Support/raw_ostream.h"#include <map>Go to the source code of this file.
Namespaces | |
| llvm | |
| This class represents lattice values for constants. | |
Macros | |
| #define | DEBUG_TYPE "lazy-value-info" |
Variables | |
| static const unsigned | MaxProcessedPerValue = 500 |
| lazy value | info |
| lazy value Lazy Value Information | Analysis |
| lazy value Lazy Value Information | false |
| print lazy value Lazy Value Info Printer | Pass |
| #define DEBUG_TYPE "lazy-value-info" |
Definition at line 44 of file LazyValueInfo.cpp.
|
static |
Definition at line 1352 of file LazyValueInfo.cpp.
References assert(), C, llvm::CastInst::getDestTy(), llvm::Constant::getIntegerValue(), llvm::BinaryOperator::getOpcode(), llvm::CastInst::getOpcode(), llvm::User::getOperand(), llvm::ValueLatticeElement::getOverdefined(), llvm::ValueLatticeElement::getRange(), llvm::Value::getType(), isOperationFoldable(), llvm::SimplifyBinOp(), and llvm::SimplifyCastInst().
Referenced by getEdgeValueLocal().
|
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 1383 of file LazyValueInfo.cpp.
References llvm::ValueLatticeElement::asConstantInteger(), assert(), C, constantFoldUser(), llvm::dbgs(), llvm::ConstantRange::difference(), llvm::ConstantInt::get(), llvm::ValueLatticeElement::get(), llvm::ValueLatticeElement::getConstantRange(), llvm::Value::getContext(), llvm::Module::getDataLayout(), getFromRangeMetadata(), llvm::Type::getInt1Ty(), llvm::Type::getIntegerBitWidth(), llvm::BasicBlock::getModule(), llvm::Value::getName(), llvm::ValueLatticeElement::getOverdefined(), llvm::ValueLatticeElement::getRange(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), getValueFromCondition(), hasSingleValue(), InBlock(), intersect(), isOperationFoldable(), llvm::ValueLatticeElement::isOverdefined(), LLVM_DEBUG, llvm::PBQP::RegAlloc::solve(), llvm::ConstantRange::unionWith(), usesOperand(), and llvm::AArch64CC::VC.
|
static |
Definition at line 581 of file LazyValueInfo.cpp.
References llvm::MCID::Call, llvm::dbgs(), llvm::dyn_cast(), llvm::ConstantPointerNull::get(), llvm::getConstantRangeFromMetadata(), llvm::Instruction::getMetadata(), llvm::Value::getName(), llvm::ValueLatticeElement::getNot(), llvm::Instruction::getOpcode(), llvm::ValueLatticeElement::getOverdefined(), llvm::Instruction::getParent(), llvm::ValueLatticeElement::getRange(), llvm::Value::getType(), llvm::Type::isIntegerTy(), llvm::isKnownNonZero(), LLVM_DEBUG, llvm::SPII::Load, and SI.
Referenced by getEdgeValueLocal().
|
static |
This lazily constructs the LazyValueInfoImpl.
Definition at line 1617 of file LazyValueInfo.cpp.
References assert().
Referenced by llvm::AttributeList::addAttributes(), llvm::AttributeList::addParamAttribute(), adjustColumn(), llvm::LazyValueInfo::disableDT(), llvm::AttributeListImpl::dump(), llvm::LazyValueInfo::enableDT(), llvm::LazyValueInfo::eraseBlock(), llvm::AttributeList::get(), llvm::ConstantArray::get(), llvm::ConstantVector::get(), llvm::ConstantDataVector::get(), llvm::MDTuple::get(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::LazyValueInfo::getConstantRangeOnEdge(), llvm::MDTuple::getDistinct(), llvm::ConstantDataArray::getFP(), llvm::ConstantDataVector::getFP(), llvm::MDTuple::getIfExists(), llvm::DIFile::ChecksumInfo< llvm::MDString *>::getKindAsString(), llvm::LazyValueInfo::getPredicateAt(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::ConstantDataArray::getRaw(), llvm::MDTuple::getTemporary(), llvm::Constant::handleOperandChange(), llvm::LazyValueInfo::printLVI(), llvm::LazyValueInfo::releaseMemory(), llvm::AttributeList::removeAttribute(), llvm::AttributeList::removeAttributes(), llvm::LazyValueInfoWrapperPass::runOnFunction(), llvm::LazyValueInfo::threadEdge(), llvm::DISubprogram::toSPFlags(), and llvm::ConstantDataSequential::~ConstantDataSequential().
|
static |
Definition at line 1776 of file LazyValueInfo.cpp.
References C, llvm::ConstantFoldCompareInstOperands(), llvm::ConstantRange::contains(), llvm::dyn_cast(), llvm::LazyValueInfo::False, llvm::ValueLatticeElement::getConstant(), llvm::ValueLatticeElement::getConstantRange(), llvm::ValueLatticeElement::getNotConstant(), llvm::ConstantInt::getValue(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::ConstantRange::inverse(), llvm::ValueLatticeElement::isConstant(), llvm::ValueLatticeElement::isConstantRange(), llvm::ValueLatticeElement::isNotConstant(), 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().
|
static |
Definition at line 1328 of file LazyValueInfo.cpp.
References assert().
Referenced by getEdgeValueLocal(), getValueFromOverflowCondition(), and isObjectDereferencedInBlock().
|
static |
Definition at line 1317 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 1284 of file LazyValueInfo.cpp.
References llvm::dyn_cast(), llvm::ExtractValueInst::getAggregateOperand(), llvm::ExtractValueInst::getNumIndices(), getValueFromICmpCondition(), getValueFromOverflowCondition(), and llvm::ExtractValueInst::idx_begin().
Referenced by getValueFromCondition().
|
static |
Definition at line 1194 of file LazyValueInfo.cpp.
References llvm::ValueLatticeElement::get(), llvm::getConstantRangeFromMetadata(), llvm::Type::getIntegerBitWidth(), llvm::CmpInst::getInversePredicate(), llvm::Instruction::getMetadata(), llvm::ValueLatticeElement::getNot(), llvm::User::getOperand(), llvm::ValueLatticeElement::getOverdefined(), llvm::CmpInst::getPredicate(), llvm::ValueLatticeElement::getRange(), 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::ConstantRange::subtract(), and std::swap().
Referenced by getValueFromConditionImpl().
|
static |
Definition at line 1259 of file LazyValueInfo.cpp.
References C, llvm::BinaryOpIntrinsic::getBinaryOp(), llvm::BinaryOpIntrinsic::getLHS(), llvm::BinaryOpIntrinsic::getNoWrapKind(), llvm::ValueLatticeElement::getOverdefined(), llvm::ValueLatticeElement::getRange(), llvm::BinaryOpIntrinsic::getRHS(), getValueFromCondition(), llvm::ConstantRange::inverse(), llvm::PatternMatch::m_APInt(), llvm::ConstantRange::makeExactNoWrapRegion(), and llvm::PatternMatch::match().
Referenced by getValueFromConditionImpl().
|
static |
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 70 of file LazyValueInfo.cpp.
References llvm::ValueLatticeElement::getConstantRange(), llvm::ValueLatticeElement::isConstant(), llvm::ValueLatticeElement::isConstantRange(), and llvm::ConstantRange::isSingleElement().
Referenced by getEdgeValueLocal(), and intersect().
| INITIALIZE_PASS_BEGIN | ( | LazyValueInfoWrapperPass | , |
| "lazy-value-info" | , | ||
| "Lazy Value Information Analysis" | , | ||
| false | , | ||
| true | |||
| ) |
| INITIALIZE_PASS_BEGIN | ( | LazyValueInfoPrinter | , |
| "print-lazy-value-info" | , | ||
| "Lazy Value Info Printer Pass" | , | ||
| false | , | ||
| false | |||
| ) |
|
static |
Definition at line 671 of file LazyValueInfo.cpp.
References llvm::dyn_cast(), llvm::GetUnderlyingObject(), llvm::ConstantInt::isZero(), 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 95 of file LazyValueInfo.cpp.
References assert(), llvm::BasicBlock::back(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::clear(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::clear(), clear(), llvm::dbgs(), llvm::numbers::e, E, llvm::SmallPtrSetImplBase::empty(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::end(), llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::erase(), llvm::SmallPtrSetImpl< PtrType >::erase(), F(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find_as(), function, llvm::ValueLatticeElement::get(), llvm::ValueLatticeElement::getConstantRange(), llvm::ValueLatticeElement::getOverdefined(), llvm::ValueLatticeElement::getRange(), hasSingleValue(), I, llvm::detail::DenseSetImpl< ValueT, DenseMap< ValueT, detail::DenseSetEmpty, ValueInfoT, detail::DenseSetPair< ValueT > >, ValueInfoT >::insert(), llvm::ConstantRange::intersectWith(), llvm::ValueLatticeElement::isConstantRange(), llvm::ValueLatticeElement::isOverdefined(), llvm::ValueLatticeElement::isUndefined(), LLVM_DEBUG, P, llvm::Function::print(), llvm::SmallVectorTemplateBase< T >::push_back(), SI, llvm::PBQP::RegAlloc::solve(), llvm::succ_begin(), llvm::succ_end(), std::swap(), and llvm::AArch64CC::VC.
Referenced by adjustDown(), llvm::MDNode::classof(), llvm::rdf::Liveness::computeLiveIns(), getEdgeValueLocal(), llvm::rdf::RegisterAggr::intersect(), and llvm::rdf::RegisterAggr::isCoverOf().
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 1690 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 706 of file LazyValueInfo.cpp.
References assert(), llvm::dbgs(), llvm::dyn_cast(), llvm::numbers::e, E, llvm::ConstantPointerNull::get(), llvm::GlobalValue::getAddressSpace(), llvm::PointerType::getAddressSpace(), llvm::Module::getDataLayout(), llvm::Function::getEntryBlock(), llvm::PHINode::getIncomingBlock(), llvm::PHINode::getIncomingValue(), llvm::BasicBlock::getModule(), llvm::Value::getName(), llvm::ValueLatticeElement::getNot(), llvm::PHINode::getNumIncomingValues(), llvm::ValueLatticeElement::getOverdefined(), llvm::BasicBlock::getParent(), llvm::Value::getType(), llvm::GetUnderlyingObject(), getValueFromCondition(), I, InstructionDereferencesPointer(), llvm::isKnownNonZero(), llvm::ValueLatticeElement::isOverdefined(), llvm::Type::isPointerTy(), LLVM_DEBUG, llvm::ValueLatticeElement::mergeIn(), llvm::NullPointerIsDefined(), llvm::pred_begin(), and llvm::pred_end().
Definition at line 1344 of file LazyValueInfo.cpp.
Referenced by constantFoldUser(), and getEdgeValueLocal().
Definition at line 1336 of file LazyValueInfo.cpp.
References llvm::find(), llvm::User::op_end(), and llvm::User::operands().
Referenced by getEdgeValueLocal().
| lazy value Lazy Value Information Analysis |
Definition at line 58 of file LazyValueInfo.cpp.
| print lazy value info |
Definition at line 58 of file LazyValueInfo.cpp.
Referenced by llvm::X86TargetLowering::convertSetCCLogicToBitwiseLogic(), findLiveReferences(), llvm::AVRTargetLowering::getCmpLibcallReturnType(), llvm::DependenceAnalysisWrapperPass::getDI(), llvm::CCState::getInRegsParamInfo(), getMemCmpLoad(), insertParsePoints(), llvm::SystemZTargetLowering::isCheapToSpeculateCtlz(), llvm::ARMTargetLowering::isSelectSupported(), llvm::LTOModule::makeBuffer(), llvm::OProfileWrapper::OProfileWrapper(), parsePredicateConstraint(), llvm::DependenceAnalysisWrapperPass::print(), recomputeLiveInValues(), llvm::DependenceAnalysisWrapperPass::releaseMemory(), llvm::DependenceAnalysisWrapperPass::runOnFunction(), llvm::PPCTargetLowering::shouldInsertFencesForAtomic(), llvm::AArch64TargetLowering::supportSwiftError(), and UnpackFromArgumentSlot().
Definition at line 48 of file LazyValueInfo.cpp.
Definition at line 2070 of file LazyValueInfo.cpp.
Referenced by llvm::legacy::FunctionPassManagerImpl::dumpPassStructure(), GetCtorAndDtorPriority(), llvm::ModuleToPostOrderCGSCCPassAdaptor< CGSCCPassT >::operator=(), llvm::slpvectorizer::BoUpSLP::VLOperands::reorder(), llvm::PassManager< Function >::run(), llvm::FunctionToLoopPassAdaptor< LoopPassT >::run(), llvm::ModuleToPostOrderCGSCCPassAdaptor< CGSCCPassT >::run(), llvm::CGSCCToFunctionPassAdaptor< FunctionPassT >::run(), llvm::DevirtSCCRepeatedPass< PassT >::run(), and llvm::ModuleToFunctionPassAdaptor< FunctionPassT >::run().
1.8.13