LLVM 17.0.0git
|
#include "llvm/Transforms/Scalar/LoopFlatten.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopNestAnalysis.h"
#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/Scalar/LoopPassManager.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
#include "llvm/Transforms/Utils/SimplifyIndVar.h"
#include <optional>
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "loop-flatten" |
Variables | |
static cl::opt< unsigned > | RepeatedInstructionThreshold ("loop-flatten-cost-threshold", cl::Hidden, cl::init(2), cl::desc("Limit on the cost of instructions that can be repeated due to " "loop flattening")) |
static cl::opt< bool > | AssumeNoOverflow ("loop-flatten-assume-no-overflow", cl::Hidden, cl::init(false), cl::desc("Assume that the product of the two iteration " "trip counts will never overflow")) |
static cl::opt< bool > | WidenIV ("loop-flatten-widen-iv", cl::Hidden, cl::init(true), cl::desc("Widen the loop induction variables, if possible, so " "overflow checks won't reject flattening")) |
#define DEBUG_TYPE "loop-flatten" |
Definition at line 83 of file LoopFlatten.cpp.
|
static |
Definition at line 683 of file LoopFlatten.cpp.
References checkIVUsers(), checkOuterLoopInsts(), checkPHIs(), llvm::dbgs(), findLoopComponents(), and LLVM_DEBUG.
Referenced by CanWidenIV(), and FlattenLoopPair().
|
static |
Definition at line 802 of file LoopFlatten.cpp.
References assert(), CanFlattenLoopPair(), llvm::createWideIV(), llvm::dbgs(), Deleted, DL, llvm::Value::dump(), LLVM_DEBUG, llvm::WideIVInfo::NarrowIV, llvm::RecursivelyDeleteDeadPHINode(), Rewriter, and WidenIV.
Referenced by FlattenLoopPair().
|
static |
Definition at line 610 of file LoopFlatten.cpp.
References llvm::dbgs(), and LLVM_DEBUG.
Referenced by CanFlattenLoopPair().
|
static |
Definition at line 543 of file LoopFlatten.cpp.
References B, Cost, llvm::SmallPtrSetImpl< PtrType >::count(), llvm::dbgs(), llvm::TargetTransformInfo::getInstructionCost(), llvm::BranchInst::getSuccessor(), I, llvm::isSafeToSpeculativelyExecute(), llvm::BranchInst::isUnconditional(), LLVM_DEBUG, llvm::PatternMatch::m_c_Mul(), llvm::PatternMatch::m_Specific(), llvm::PatternMatch::match(), RepeatedInstructionThreshold, and llvm::TargetTransformInfo::TCK_SizeAndLatency.
Referenced by CanFlattenLoopPair().
|
static |
Definition at line 634 of file LoopFlatten.cpp.
References AssumeNoOverflow, llvm::computeOverflowForUnsignedMul(), llvm::dbgs(), DL, F, GEP, llvm::isGuaranteedToExecuteForEveryIteration(), and LLVM_DEBUG.
Referenced by FlattenLoopPair().
|
static |
Definition at line 458 of file LoopFlatten.cpp.
References assert(), llvm::SmallPtrSetImpl< PtrType >::count(), llvm::dbgs(), llvm::Value::dump(), llvm::PHINode::getIncomingValueForBlock(), llvm::Instruction::getParent(), llvm::PHINode::hasConstantValue(), llvm::SmallPtrSetImpl< PtrType >::insert(), and LLVM_DEBUG.
Referenced by CanFlattenLoopPair().
|
static |
Definition at line 729 of file LoopFlatten.cpp.
References Builder, llvm::BranchInst::Create(), llvm::dbgs(), DEBUG_TYPE, llvm::DominatorTreeBase< NodeT, IsPostDom >::deleteEdge(), llvm::Value::dump(), llvm::OptimizationRemarkEmitter::emit(), llvm::LoopInfo::erase(), llvm::Instruction::eraseFromParent(), F, llvm::ScalarEvolution::forgetBlockAndLoopDispositions(), llvm::ScalarEvolution::forgetLoop(), llvm::BasicBlock::getTerminator(), LLVM_DEBUG, PHI, llvm::Remark, and llvm::MemorySSAUpdater::removeEdge().
Referenced by FlattenLoopPair().
|
static |
Definition at line 378 of file LoopFlatten.cpp.
References llvm::dbgs(), llvm::Value::dump(), llvm::PHINode::getIncomingValueForBlock(), llvm::Instruction::getSuccessor(), llvm::BasicBlock::getTerminator(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::CmpInst::ICMP_ULT, llvm::SmallPtrSetImpl< PtrType >::insert(), LLVM_DEBUG, RHS, and verifyTripCount().
Referenced by CanFlattenLoopPair().
|
static |
Definition at line 868 of file LoopFlatten.cpp.
References CanFlattenLoopPair(), CanWidenIV(), checkOverflow(), llvm::dbgs(), DoFlattenLoopPair(), and LLVM_DEBUG.
Referenced by llvm::LoopFlattenPass::run().
|
static |
Definition at line 295 of file LoopFlatten.cpp.
References llvm::dbgs(), llvm::Value::dump(), llvm::SmallPtrSetImpl< PtrType >::insert(), and LLVM_DEBUG.
Referenced by verifyTripCount().
STATISTIC | ( | NumFlattened | , |
"Number of loops flattened" | |||
) |
|
static |
Definition at line 311 of file LoopFlatten.cpp.
References llvm::dbgs(), llvm::ConstantInt::get(), llvm::ScalarEvolution::getBackedgeTakenCount(), llvm::Value::getContext(), llvm::ScalarEvolution::getSCEV(), llvm::ScalarEvolution::getTripCountFromExitCount(), llvm::ConstantInt::getType(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::ScalarEvolution::getZeroExtendExpr(), LLVM_DEBUG, RHS, and setLoopComponents().
Referenced by findLoopComponents().
|
static |
Referenced by checkOverflow().
|
static |
Referenced by checkOuterLoopInsts().
|
static |
Definition at line 1172 of file SimplifyIndVar.cpp.
Referenced by CanWidenIV(), and llvm::createWideIV().