|
LLVM 23.0.0git
|
#include "llvm/Transforms/Scalar/CorrelatedValuePropagation.h"#include "llvm/ADT/DepthFirstIterator.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/Analysis/DomTreeUpdater.h"#include "llvm/Analysis/GlobalsModRef.h"#include "llvm/Analysis/InstructionSimplify.h"#include "llvm/Analysis/LazyValueInfo.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/IR/Attributes.h"#include "llvm/IR/BasicBlock.h"#include "llvm/IR/CFG.h"#include "llvm/IR/Constant.h"#include "llvm/IR/ConstantRange.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DerivedTypes.h"#include "llvm/IR/Function.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/InstrTypes.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/MDBuilder.h"#include "llvm/IR/Operator.h"#include "llvm/IR/PassManager.h"#include "llvm/IR/PatternMatch.h"#include "llvm/IR/ProfDataUtils.h"#include "llvm/IR/Type.h"#include "llvm/IR/Value.h"#include "llvm/Support/Casting.h"#include "llvm/Transforms/Utils/Local.h"#include <cassert>#include <optional>#include <utility>Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "correlated-value-propagation" |
Enumerations | |
| enum class | Domain { NonNegative , NonPositive , Unknown } |
Functions | |
| STATISTIC (NumPhis, "Number of phis propagated") | |
| STATISTIC (NumPhiCommon, "Number of phis deleted via common incoming value") | |
| STATISTIC (NumSelects, "Number of selects propagated") | |
| STATISTIC (NumCmps, "Number of comparisons propagated") | |
| STATISTIC (NumReturns, "Number of return values propagated") | |
| STATISTIC (NumDeadCases, "Number of switch cases removed") | |
| STATISTIC (NumSDivSRemsNarrowed, "Number of sdivs/srems whose width was decreased") | |
| STATISTIC (NumSDivs, "Number of sdiv converted to udiv") | |
| STATISTIC (NumUDivURemsNarrowed, "Number of udivs/urems whose width was decreased") | |
| STATISTIC (NumAShrsConverted, "Number of ashr converted to lshr") | |
| STATISTIC (NumAShrsRemoved, "Number of ashr removed") | |
| STATISTIC (NumSRems, "Number of srem converted to urem") | |
| STATISTIC (NumSExt, "Number of sext converted to zext") | |
| STATISTIC (NumSIToFP, "Number of sitofp converted to uitofp") | |
| STATISTIC (NumSICmps, "Number of signed icmp preds simplified to unsigned") | |
| STATISTIC (NumAnd, "Number of ands removed") | |
| STATISTIC (NumNW, "Number of no-wrap deductions") | |
| STATISTIC (NumNSW, "Number of no-signed-wrap deductions") | |
| STATISTIC (NumNUW, "Number of no-unsigned-wrap deductions") | |
| STATISTIC (NumAddNW, "Number of no-wrap deductions for add") | |
| STATISTIC (NumAddNSW, "Number of no-signed-wrap deductions for add") | |
| STATISTIC (NumAddNUW, "Number of no-unsigned-wrap deductions for add") | |
| STATISTIC (NumSubNW, "Number of no-wrap deductions for sub") | |
| STATISTIC (NumSubNSW, "Number of no-signed-wrap deductions for sub") | |
| STATISTIC (NumSubNUW, "Number of no-unsigned-wrap deductions for sub") | |
| STATISTIC (NumMulNW, "Number of no-wrap deductions for mul") | |
| STATISTIC (NumMulNSW, "Number of no-signed-wrap deductions for mul") | |
| STATISTIC (NumMulNUW, "Number of no-unsigned-wrap deductions for mul") | |
| STATISTIC (NumShlNW, "Number of no-wrap deductions for shl") | |
| STATISTIC (NumShlNSW, "Number of no-signed-wrap deductions for shl") | |
| STATISTIC (NumShlNUW, "Number of no-unsigned-wrap deductions for shl") | |
| STATISTIC (NumAbs, "Number of llvm.abs intrinsics removed") | |
| STATISTIC (NumOverflows, "Number of overflow checks removed") | |
| STATISTIC (NumSaturating, "Number of saturating arithmetics converted to normal arithmetics") | |
| STATISTIC (NumNonNull, "Number of function pointer arguments marked non-null") | |
| STATISTIC (NumCmpIntr, "Number of llvm.[us]cmp intrinsics removed") | |
| STATISTIC (NumMinMax, "Number of llvm.[us]{min,max} intrinsics removed") | |
| STATISTIC (NumSMinMax, "Number of llvm.s{min,max} intrinsics simplified to unsigned") | |
| STATISTIC (NumUDivURemsNarrowedExpanded, "Number of bound udiv's/urem's expanded") | |
| STATISTIC (NumNNeg, "Number of zext/uitofp non-negative deductions") | |
| static Constant * | getConstantAt (Value *V, Instruction *At, LazyValueInfo *LVI) |
| static bool | processSelect (SelectInst *S, LazyValueInfo *LVI) |
| static bool | simplifyCommonValuePhi (PHINode *P, LazyValueInfo *LVI, DominatorTree *DT) |
| Try to simplify a phi with constant incoming values that match the edge values of a non-constant value on all other edges: bb0: isnull = icmp eq i8* x, null br i1 isnull, label bb2, label bb1 bb1: br label bb2 bb2: r = phi i8* [ x, bb1 ], [ null, bb0 ] --> r = x. | |
| static Value * | getValueOnEdge (LazyValueInfo *LVI, Value *Incoming, BasicBlock *From, BasicBlock *To, Instruction *CxtI) |
| static bool | processPHI (PHINode *P, LazyValueInfo *LVI, DominatorTree *DT, const SimplifyQuery &SQ) |
| static bool | processICmp (ICmpInst *Cmp, LazyValueInfo *LVI) |
| static bool | constantFoldCmp (CmpInst *Cmp, LazyValueInfo *LVI) |
| See if LazyValueInfo's ability to exploit edge conditions or range information is sufficient to prove this comparison. | |
| static bool | processCmp (CmpInst *Cmp, LazyValueInfo *LVI) |
| static bool | processSwitch (SwitchInst *I, LazyValueInfo *LVI, DominatorTree *DT) |
| Simplify a switch instruction by removing cases which can never fire. | |
| static bool | willNotOverflow (BinaryOpIntrinsic *BO, LazyValueInfo *LVI) |
| static void | setDeducedOverflowingFlags (Value *V, Instruction::BinaryOps Opcode, bool NewNSW, bool NewNUW) |
| static bool | processBinOp (BinaryOperator *BinOp, LazyValueInfo *LVI) |
| static bool | processAbsIntrinsic (IntrinsicInst *II, LazyValueInfo *LVI) |
| static bool | processCmpIntrinsic (CmpIntrinsic *CI, LazyValueInfo *LVI) |
| static bool | processMinMaxIntrinsic (MinMaxIntrinsic *MM, LazyValueInfo *LVI) |
| static bool | processOverflowIntrinsic (WithOverflowInst *WO, LazyValueInfo *LVI) |
| static bool | processSaturatingInst (SaturatingInst *SI, LazyValueInfo *LVI) |
| static bool | processCallSite (CallBase &CB, LazyValueInfo *LVI) |
| Infer nonnull attributes for the arguments at the specified callsite. | |
| static Domain | getDomain (const ConstantRange &CR) |
| static bool | narrowSDivOrSRem (BinaryOperator *Instr, const ConstantRange &LCR, const ConstantRange &RCR) |
| Try to shrink a sdiv/srem's width down to the smallest power of two that's sufficient to contain its operands. | |
| static bool | expandUDivOrURem (BinaryOperator *Instr, const ConstantRange &XCR, const ConstantRange &YCR) |
| static bool | narrowUDivOrURem (BinaryOperator *Instr, const ConstantRange &XCR, const ConstantRange &YCR) |
| Try to shrink a udiv/urem's width down to the smallest power of two that's sufficient to contain its operands. | |
| static bool | processUDivOrURem (BinaryOperator *Instr, LazyValueInfo *LVI) |
| static bool | processSRem (BinaryOperator *SDI, const ConstantRange &LCR, const ConstantRange &RCR, LazyValueInfo *LVI) |
| static bool | processSDiv (BinaryOperator *SDI, const ConstantRange &LCR, const ConstantRange &RCR, LazyValueInfo *LVI) |
| See if LazyValueInfo's ability to exploit edge conditions or range information is sufficient to prove the signs of both operands of this SDiv. | |
| static bool | processSDivOrSRem (BinaryOperator *Instr, LazyValueInfo *LVI) |
| static bool | processAShr (BinaryOperator *SDI, LazyValueInfo *LVI) |
| static bool | processSExt (SExtInst *SDI, LazyValueInfo *LVI) |
| static bool | processPossibleNonNeg (PossiblyNonNegInst *I, LazyValueInfo *LVI) |
| static bool | processZExt (ZExtInst *ZExt, LazyValueInfo *LVI) |
| static bool | processUIToFP (UIToFPInst *UIToFP, LazyValueInfo *LVI) |
| static bool | processSIToFP (SIToFPInst *SIToFP, LazyValueInfo *LVI) |
| static bool | processAnd (BinaryOperator *BinOp, LazyValueInfo *LVI) |
| static bool | processTrunc (TruncInst *TI, LazyValueInfo *LVI) |
| static bool | runImpl (Function &F, LazyValueInfo *LVI, DominatorTree *DT, const SimplifyQuery &SQ) |
| #define DEBUG_TYPE "correlated-value-propagation" |
Definition at line 50 of file CorrelatedValuePropagation.cpp.
|
strong |
| Enumerator | |
|---|---|
| NonNegative | |
| NonPositive | |
| Unknown | |
Definition at line 758 of file CorrelatedValuePropagation.cpp.
|
static |
See if LazyValueInfo's ability to exploit edge conditions or range information is sufficient to prove this comparison.
Even for local conditions, this can sometimes prove conditions instcombine can't by exploiting range information.
Definition at line 328 of file CorrelatedValuePropagation.cpp.
References llvm::LazyValueInfo::getPredicateAt().
Referenced by processCmp().
|
static |
Definition at line 816 of file CorrelatedValuePropagation.cpp.
References assert(), B(), DEBUG_TYPE, llvm::Constant::getNullValue(), llvm::ConstantRange::icmp(), llvm::CmpInst::ICMP_UGE, llvm::CmpInst::ICMP_ULT, llvm::ConstantRange::isAllNegative(), llvm::isGuaranteedNotToBeUndef(), llvm::Value::takeName(), llvm::ConstantRange::uadd_sat(), X, and Y.
Referenced by processUDivOrURem().
|
static |
Definition at line 98 of file CorrelatedValuePropagation.cpp.
References llvm::CallingConv::C, llvm::dyn_cast(), llvm::LazyValueInfo::getConstant(), and llvm::LazyValueInfo::getPredicateAt().
Referenced by processSelect(), and runImpl().
|
static |
Definition at line 760 of file CorrelatedValuePropagation.cpp.
References llvm::ConstantRange::getBitWidth(), llvm::APInt::getZero(), llvm::ConstantRange::icmp(), llvm::CmpInst::ICMP_SLE, llvm::ConstantRange::isAllNonNegative(), NonNegative, NonPositive, and Unknown.
Referenced by collectMDInDomain(), llvm::ScopedNoAliasAAResult::collectScopedDomains(), llvm::MDNode::getMostGenericAliasScope(), processSDiv(), and processSRem().
|
static |
Definition at line 208 of file CorrelatedValuePropagation.cpp.
References llvm::CallingConv::C, llvm::dyn_cast(), llvm::dyn_cast_or_null(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::Value::getType(), llvm::CmpInst::ICMP_EQ, and llvm::Type::isVectorTy().
Referenced by processPHI().
|
static |
Try to shrink a sdiv/srem's width down to the smallest power of two that's sufficient to contain its operands.
Definition at line 770 of file CorrelatedValuePropagation.cpp.
References assert(), B(), llvm::ConstantRange::contains(), llvm::dyn_cast(), llvm::APInt::getAllOnes(), llvm::ConstantRange::getMinSignedBits(), llvm::APInt::getSignedMinValue(), LHS, llvm::PowerOf2Ceil(), and RHS.
Referenced by processSDivOrSRem().
|
static |
Try to shrink a udiv/urem's width down to the smallest power of two that's sufficient to contain its operands.
Definition at line 898 of file CorrelatedValuePropagation.cpp.
References assert(), B(), llvm::dyn_cast(), llvm::ConstantRange::getActiveBits(), LHS, llvm::PowerOf2Ceil(), and RHS.
Referenced by processUDivOrURem().
|
static |
Definition at line 523 of file CorrelatedValuePropagation.cpp.
References B(), llvm::cast(), llvm::dyn_cast(), llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::APInt::getSignedMinValue(), llvm::ConstantInt::getTrue(), llvm::CmpInst::ICMP_ULE, II, processBinOp(), Range, and X.
Referenced by processCallSite().
|
static |
Definition at line 1207 of file CorrelatedValuePropagation.cpp.
References llvm::Instruction::eraseFromParent(), llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::User::getOperand(), llvm::User::getOperandUse(), llvm::ConstantRange::getUnsignedMax(), LHS, llvm::PatternMatch::m_LowBitMask(), llvm::PatternMatch::match(), llvm::Value::replaceAllUsesWith(), RHS, and llvm::APInt::ule().
Referenced by runImpl().
|
static |
Definition at line 1085 of file CorrelatedValuePropagation.cpp.
References llvm::ConstantRange::contains(), llvm::Instruction::eraseFromParent(), llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::Instruction::getDebugLoc(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::User::getOperand(), llvm::User::getOperandUse(), llvm::Type::getScalarSizeInBits(), llvm::Value::getType(), llvm::ConstantRange::isAllNonNegative(), llvm::Instruction::isExact(), and llvm::Value::replaceAllUsesWith().
Referenced by runImpl().
|
static |
Definition at line 1173 of file CorrelatedValuePropagation.cpp.
References Changed, llvm::ConstantRange::contains(), llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperandUse(), llvm::Instruction::hasNoSignedWrap(), llvm::Instruction::hasNoUnsignedWrap(), llvm::ConstantRange::makeGuaranteedNoWrapRegion(), and setDeducedOverflowingFlags().
Referenced by processAbsIntrinsic(), processOverflowIntrinsic(), processSaturatingInst(), and runImpl().
|
static |
Infer nonnull attributes for the arguments at the specified callsite.
Definition at line 678 of file CorrelatedValuePropagation.cpp.
References llvm::CallBase::arg_size(), llvm::CallBase::args(), assert(), llvm::CallingConv::C, llvm::cast(), Changed, llvm::dyn_cast(), llvm::dyn_cast_or_null(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::Attribute::get(), llvm::ConstantPointerNull::get(), llvm::CallBase::getAttributes(), llvm::LazyValueInfo::getConstant(), llvm::Value::getContext(), llvm::CallBase::getIntrinsicID(), llvm::CallBase::getOperandBundle(), llvm::LazyValueInfo::getPredicateAt(), llvm::CmpInst::ICMP_EQ, llvm::isa(), llvm::LLVMContext::OB_deopt, llvm::CallBase::paramHasAttr(), processAbsIntrinsic(), processCmpIntrinsic(), processMinMaxIntrinsic(), processOverflowIntrinsic(), processSaturatingInst(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::CallBase::setAttributes(), llvm::SmallVectorTemplateCommon< T, typename >::size(), and willNotOverflow().
Referenced by runImpl().
|
static |
Definition at line 342 of file CorrelatedValuePropagation.cpp.
References constantFoldCmp(), llvm::dyn_cast(), and processICmp().
Referenced by runImpl().
|
static |
Definition at line 565 of file CorrelatedValuePropagation.cpp.
References llvm::Instruction::eraseFromParent(), llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::CmpIntrinsic::getGTPredicate(), llvm::CmpIntrinsic::getLTPredicate(), llvm::User::getOperandUse(), llvm::ConstantInt::getSigned(), llvm::Value::getType(), llvm::ConstantRange::icmp(), llvm::CmpInst::ICMP_EQ, and llvm::Value::replaceAllUsesWith().
Referenced by processCallSite().
|
static |
Definition at line 288 of file CorrelatedValuePropagation.cpp.
References llvm::ConstantRange::areInsensitiveToSignednessOfICmpPredicate(), llvm::CmpInst::BAD_ICMP_PREDICATE, Changed, llvm::LazyValueInfo::getConstantRangeAtUse(), and llvm::ConstantRange::getEquivalentPredWithFlippedSignedness().
Referenced by processCmp().
|
static |
Definition at line 595 of file CorrelatedValuePropagation.cpp.
References llvm::ConstantRange::areInsensitiveToSignednessOfICmpPredicate(), B(), llvm::Instruction::eraseFromParent(), llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::IntrinsicInst::getIntrinsicID(), llvm::MinMaxIntrinsic::getLHS(), llvm::CmpInst::getNonStrictPredicate(), llvm::User::getOperandUse(), llvm::MinMaxIntrinsic::getPredicate(), llvm::MinMaxIntrinsic::getRHS(), llvm::ConstantRange::icmp(), llvm::MinMaxIntrinsic::isSigned(), and llvm::Value::replaceAllUsesWith().
Referenced by processCallSite().
|
static |
Definition at line 631 of file CorrelatedValuePropagation.cpp.
References B(), llvm::cast(), llvm::dyn_cast(), llvm::Instruction::eraseFromParent(), llvm::ConstantStruct::get(), llvm::PoisonValue::get(), llvm::BinaryOpIntrinsic::getBinaryOp(), llvm::ConstantInt::getFalse(), llvm::BinaryOpIntrinsic::getLHS(), llvm::Value::getName(), llvm::BinaryOpIntrinsic::getRHS(), llvm::Value::getType(), llvm::BinaryOpIntrinsic::isSigned(), processBinOp(), llvm::Value::replaceAllUsesWith(), and setDeducedOverflowingFlags().
Referenced by processCallSite().
|
static |
Definition at line 257 of file CorrelatedValuePropagation.cpp.
References Changed, getValueOnEdge(), llvm::isa(), P, simplifyCommonValuePhi(), and llvm::simplifyInstruction().
Referenced by runImpl().
|
static |
Definition at line 1132 of file CorrelatedValuePropagation.cpp.
References llvm::sampleprof::Base, llvm::LazyValueInfo::getConstantRangeAtUse(), I, and llvm::ConstantRange::isAllNonNegative().
Referenced by processUIToFP(), and processZExt().
|
static |
Definition at line 657 of file CorrelatedValuePropagation.cpp.
References llvm::BinaryOperator::Create(), llvm::dyn_cast(), processBinOp(), llvm::Instruction::setDebugLoc(), and setDeducedOverflowingFlags().
Referenced by processCallSite().
|
static |
See if LazyValueInfo's ability to exploit edge conditions or range information is sufficient to prove the signs of both operands of this SDiv.
If this is the case, replace the SDiv with a UDiv. Even for local conditions, this can sometimes prove conditions instcombine can't by exploiting range information.
Definition at line 1008 of file CorrelatedValuePropagation.cpp.
References AbstractManglingParser< Derived, Alloc >::Ops, assert(), llvm::BinaryOperator::CreateNeg(), D(), llvm::Instruction::eraseFromParent(), llvm::Instruction::getDebugLoc(), getDomain(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Value::getName(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::ConstantRange::getSingleElement(), llvm::Value::getType(), llvm::Instruction::isExact(), NonNegative, processUDivOrURem(), llvm::Value::replaceAllUsesWith(), llvm::ConstantRange::sdiv(), and Unknown.
Referenced by processSDivOrSRem().
|
static |
Definition at line 1065 of file CorrelatedValuePropagation.cpp.
References assert(), llvm::LazyValueInfo::getConstantRangeAtUse(), narrowSDivOrSRem(), processSDiv(), and processSRem().
Referenced by runImpl().
|
static |
Definition at line 117 of file CorrelatedValuePropagation.cpp.
References llvm::CallingConv::C, llvm::cast(), Changed, llvm::dyn_cast(), llvm::dyn_cast_or_null(), llvm::Instruction::eraseFromParent(), llvm::SelectInst::getCondition(), getConstantAt(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::SelectInst::getFalseValue(), llvm::SelectInst::getTrueValue(), llvm::Value::getType(), I, llvm::isa(), llvm::Type::isVectorTy(), llvm::make_early_inc_range(), llvm::Value::use_empty(), and llvm::Value::uses().
Referenced by runImpl().
|
static |
Definition at line 1114 of file CorrelatedValuePropagation.cpp.
References llvm::sampleprof::Base, llvm::CastInst::CreateZExtOrBitCast(), llvm::Instruction::eraseFromParent(), llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::Instruction::getDebugLoc(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::User::getOperandUse(), llvm::Value::getType(), llvm::ConstantRange::isAllNonNegative(), and llvm::Value::replaceAllUsesWith().
Referenced by runImpl().
|
static |
Definition at line 1155 of file CorrelatedValuePropagation.cpp.
References llvm::sampleprof::Base, llvm::CastInst::Create(), llvm::Instruction::eraseFromParent(), llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::Instruction::getDebugLoc(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::User::getOperandUse(), llvm::Value::getType(), llvm::ConstantRange::isAllNonNegative(), and llvm::Value::replaceAllUsesWith().
Referenced by runImpl().
|
static |
Definition at line 949 of file CorrelatedValuePropagation.cpp.
References llvm::ConstantRange::abs(), AbstractManglingParser< Derived, Alloc >::Ops, assert(), llvm::BinaryOperator::CreateNeg(), D(), llvm::Instruction::eraseFromParent(), llvm::Instruction::getDebugLoc(), getDomain(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::Value::getName(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), llvm::ConstantRange::icmp(), llvm::CmpInst::ICMP_ULT, NonNegative, NonPositive, processUDivOrURem(), llvm::Value::replaceAllUsesWith(), and Unknown.
Referenced by processSDivOrSRem().
|
static |
Simplify a switch instruction by removing cases which can never fire.
If the uselessness of a case could be determined locally then constant propagation would already have figured it out. Instead, walk the predecessors and statically evaluate cases based on information available on that edge. Cases that cannot fire no matter what the incoming edge can safely be removed. If a case fires on every incoming edge then the entire switch can be removed and replaced with a branch to the case destination.
Definition at line 360 of file CorrelatedValuePropagation.cpp.
References llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdatesPermissive(), Changed, Cond, llvm::ConstantFoldTerminator(), llvm::ConstantRange::contains(), llvm::BasicBlock::Create(), llvm::DominatorTreeBase< BasicBlock, false >::Delete, llvm::dyn_cast_or_null(), llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::BasicBlock::getContext(), llvm::BasicBlock::getParent(), llvm::LazyValueInfo::getPredicateAt(), llvm::ConstantRange::getSingleElement(), llvm::DebugLoc::getTemporary(), llvm::ConstantInt::getValue(), I, llvm::CmpInst::ICMP_EQ, llvm::DominatorTreeBase< BasicBlock, false >::Insert, llvm::ConstantRange::isSingleElement(), llvm::ConstantRange::isSizeLargerThan(), llvm::BasicBlock::removePredecessor(), and llvm::successors().
Referenced by runImpl().
|
static |
Definition at line 1230 of file CorrelatedValuePropagation.cpp.
References Changed, llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::CastInst::getDestTy(), llvm::User::getOperandUse(), llvm::Type::getScalarSizeInBits(), llvm::TruncInst::hasNoSignedWrap(), llvm::TruncInst::hasNoUnsignedWrap(), Range, llvm::TruncInst::setHasNoSignedWrap(), and llvm::TruncInst::setHasNoUnsignedWrap().
Referenced by runImpl().
|
static |
Definition at line 935 of file CorrelatedValuePropagation.cpp.
References assert(), expandUDivOrURem(), llvm::LazyValueInfo::getConstantRangeAtUse(), and narrowUDivOrURem().
Referenced by processSDiv(), processSRem(), and runImpl().
|
static |
Definition at line 1151 of file CorrelatedValuePropagation.cpp.
References llvm::cast(), and processPossibleNonNeg().
Referenced by runImpl().
|
static |
Definition at line 1147 of file CorrelatedValuePropagation.cpp.
References llvm::cast(), and processPossibleNonNeg().
Referenced by runImpl().
|
static |
Definition at line 1258 of file CorrelatedValuePropagation.cpp.
References llvm::CallingConv::C, llvm::cast(), llvm::depth_first(), F, getConstantAt(), llvm::LazyValueInfo::getConstantRange(), llvm::Attribute::getRange(), II, llvm::isa(), llvm::Attribute::isValid(), llvm::make_early_inc_range(), processAnd(), processAShr(), processBinOp(), processCallSite(), processCmp(), processPHI(), processSDivOrSRem(), processSelect(), processSExt(), processSIToFP(), processSwitch(), processTrunc(), processUDivOrURem(), processUIToFP(), and processZExt().
|
static |
Definition at line 471 of file CorrelatedValuePropagation.cpp.
References llvm::dyn_cast(), and llvm_unreachable.
Referenced by processBinOp(), processOverflowIntrinsic(), and processSaturatingInst().
|
static |
Try to simplify a phi with constant incoming values that match the edge values of a non-constant value on all other edges: bb0: isnull = icmp eq i8* x, null br i1 isnull, label bb2, label bb1 bb1: br label bb2 bb2: r = phi i8* [ x, bb1 ], [ null, bb0 ] --> r = x.
Definition at line 157 of file CorrelatedValuePropagation.cpp.
References llvm::CallingConv::C, llvm::DominatorTree::dominates(), llvm::dyn_cast(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::isGuaranteedNotToBePoison(), P, and llvm::SmallVectorTemplateBase< T, bool >::push_back().
Referenced by processPHI().
| STATISTIC | ( | NumAbs | , |
| "Number of llvm.abs intrinsics removed" | ) |
| STATISTIC | ( | NumAnd | , |
| "Number of ands removed" | ) |
| STATISTIC | ( | NumAShrsConverted | , |
| "Number of ashr converted to lshr" | ) |
| STATISTIC | ( | NumAShrsRemoved | , |
| "Number of ashr removed" | ) |
| STATISTIC | ( | NumCmpIntr | , |
| "Number of llvm.cmp intrinsics removed" | [us] ) |
| STATISTIC | ( | NumCmps | , |
| "Number of comparisons propagated" | ) |
| STATISTIC | ( | NumDeadCases | , |
| "Number of switch cases removed" | ) |
| STATISTIC | ( | NumMinMax | , |
| "Number of llvm.{min,max} intrinsics removed" | [us] ) |
| STATISTIC | ( | NumNNeg | , |
| "Number of zext/uitofp non-negative deductions" | ) |
| STATISTIC | ( | NumNSW | , |
| "Number of no-signed-wrap deductions" | ) |
| STATISTIC | ( | NumNW | , |
| "Number of no-wrap deductions" | ) |
| STATISTIC | ( | NumOverflows | , |
| "Number of overflow checks removed" | ) |
| STATISTIC | ( | NumPhiCommon | , |
| "Number of phis deleted via common incoming value" | ) |
| STATISTIC | ( | NumPhis | , |
| "Number of phis propagated" | ) |
| STATISTIC | ( | NumReturns | , |
| "Number of return values propagated" | ) |
| STATISTIC | ( | NumSaturating | , |
| "Number of saturating arithmetics converted to normal arithmetics" | ) |
| STATISTIC | ( | NumSDivs | , |
| "Number of sdiv converted to udiv" | ) |
| STATISTIC | ( | NumSDivSRemsNarrowed | , |
| "Number of sdivs/srems whose width was decreased" | ) |
| STATISTIC | ( | NumSelects | , |
| "Number of selects propagated" | ) |
| STATISTIC | ( | NumSExt | , |
| "Number of sext converted to zext" | ) |
| STATISTIC | ( | NumSICmps | , |
| "Number of signed icmp preds simplified to unsigned" | ) |
| STATISTIC | ( | NumSIToFP | , |
| "Number of sitofp converted to uitofp" | ) |
| STATISTIC | ( | NumSMinMax | , |
| "Number of llvm.s{min,max} intrinsics simplified to unsigned" | ) |
| STATISTIC | ( | NumSRems | , |
| "Number of srem converted to urem" | ) |
| STATISTIC | ( | NumUDivURemsNarrowed | , |
| "Number of udivs/urems whose width was decreased" | ) |
| STATISTIC | ( | NumUDivURemsNarrowedExpanded | , |
| "Number of bound udiv's/urem's expanded" | ) |
|
static |
Definition at line 461 of file CorrelatedValuePropagation.cpp.
References llvm::ConstantRange::contains(), llvm::BinaryOpIntrinsic::getBinaryOp(), llvm::LazyValueInfo::getConstantRangeAtUse(), llvm::BinaryOpIntrinsic::getNoWrapKind(), llvm::User::getOperandUse(), and llvm::ConstantRange::makeGuaranteedNoWrapRegion().
Referenced by processCallSite().