|
LLVM 24.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/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 void | setDeducedOverflowingFlags (Value *V, Instruction::BinaryOps Opcode, bool NewNSW, bool NewNUW) |
| 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 NoWrapFlags | computeNoWrapFlags (Instruction::BinaryOps Opcode, const ConstantRange &LRange, const ConstantRange &RRange, bool CheckNSW, bool CheckNUW) |
| #define DEBUG_TYPE "correlated-value-propagation" |
Definition at line 49 of file CorrelatedValuePropagation.cpp.
|
strong |
| Enumerator | |
|---|---|
| NonNegative | |
| NonPositive | |
| Unknown | |
Definition at line 819 of file CorrelatedValuePropagation.cpp.
|
static |
Definition at line 1243 of file CorrelatedValuePropagation.cpp.
References llvm::ConstantRange::contains(), and llvm::ConstantRange::makeGuaranteedNoWrapRegion().
|
static |
Definition at line 877 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::salvageDebugInfo(), llvm::Value::takeName(), llvm::ConstantRange::uadd_sat(), X, and Y.
|
static |
Definition at line 821 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(), and llvm::MDNode::getMostGenericAliasScope().
|
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 831 of file CorrelatedValuePropagation.cpp.
References assert(), B(), llvm::ConstantRange::contains(), llvm::dyn_cast(), llvm::APInt::getAllOnes(), llvm::ConstantRange::getMinSignedBits(), llvm::BinaryOperator::getOpcode(), llvm::APInt::getSignedMinValue(), LHS, llvm::PowerOf2Ceil(), RHS, and llvm::Instruction::setIsExact().
|
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 960 of file CorrelatedValuePropagation.cpp.
References assert(), B(), llvm::dyn_cast(), llvm::ConstantRange::getActiveBits(), llvm::BinaryOperator::getOpcode(), LHS, llvm::PowerOf2Ceil(), RHS, and llvm::Instruction::setIsExact().
|
static |
Definition at line 535 of file CorrelatedValuePropagation.cpp.
References llvm::dyn_cast(), and llvm_unreachable.
| 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" | ) |
References F.
| 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" | ) |