LLVM  14.0.0git
Classes | Macros | Functions | Variables
LoopUtils.cpp File Reference
#include "llvm/Transforms/Utils/LoopUtils.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/PriorityWorklist.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopAccessAnalysis.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/Analysis/MustExecute.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
Include dependency graph for LoopUtils.cpp:

Go to the source code of this file.

Classes

struct  RewritePhi
 
struct  PointerBounds
 IR Values for the lower and upper bounds of a pointer evolution. More...
 

Macros

#define DEBUG_TYPE   "loop-utils"
 

Functions

static MDNodecreateStringMetadata (Loop *TheLoop, StringRef Name, unsigned V)
 Create MDNode for input string. More...
 
static LoopgetOutermostLoop (Loop *L)
 
static BranchInstgetExpectedExitLoopLatchBranch (Loop *L)
 Checks if L has single exit through latch block except possibly "deoptimizing" exits. More...
 
static bool hasHardUserWithinLoop (const Loop *L, const Instruction *I)
 
static bool canLoopBeDeleted (Loop *L, SmallVector< RewritePhi, 8 > &RewritePhiSet)
 
static PointerBounds expandBounds (const RuntimeCheckingPtrGroup *CG, Loop *TheLoop, Instruction *Loc, SCEVExpander &Exp)
 Expand code for the lower and upper bound of the pointer group CG in TheLoop. More...
 
static SmallVector< std::pair< PointerBounds, PointerBounds >, 4 > expandBounds (const SmallVectorImpl< RuntimePointerCheck > &PointerChecks, Loop *L, Instruction *Loc, SCEVExpander &Exp)
 Turns a collection of checks into a collection of expanded upper and lower bounds for both pointers in the check. More...
 

Variables

static const char * LLVMLoopDisableNonforced = "llvm.loop.disable_nonforced"
 
static const char * LLVMLoopDisableLICM = "llvm.licm.disable"
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "loop-utils"

Definition at line 57 of file LoopUtils.cpp.

Function Documentation

◆ canLoopBeDeleted()

static bool canLoopBeDeleted ( Loop L,
SmallVector< RewritePhi, 8 > &  RewritePhiSet 
)
static

◆ createStringMetadata()

static MDNode* createStringMetadata ( Loop TheLoop,
StringRef  Name,
unsigned  V 
)
static

◆ expandBounds() [1/2]

static PointerBounds expandBounds ( const RuntimeCheckingPtrGroup CG,
Loop TheLoop,
Instruction Loc,
SCEVExpander Exp 
)
static

Expand code for the lower and upper bound of the pointer group CG in TheLoop.

Returns
the values for the bounds.

Definition at line 1481 of file LoopUtils.cpp.

References llvm::RuntimeCheckingPtrGroup::AddressSpace, llvm::Value::getContext(), and llvm::Type::getInt8PtrTy().

Referenced by llvm::addRuntimeChecks(), and expandBounds().

◆ expandBounds() [2/2]

static SmallVector<std::pair<PointerBounds, PointerBounds>, 4> expandBounds ( const SmallVectorImpl< RuntimePointerCheck > &  PointerChecks,
Loop L,
Instruction Loc,
SCEVExpander Exp 
)
static

Turns a collection of checks into a collection of expanded upper and lower bounds for both pointers in the check.

Definition at line 1498 of file LoopUtils.cpp.

References Check(), expandBounds(), First, and llvm::transform().

◆ getExpectedExitLoopLatchBranch()

static BranchInst* getExpectedExitLoopLatchBranch ( Loop L)
static

◆ getOutermostLoop()

static Loop* getOutermostLoop ( Loop L)
static

Definition at line 698 of file LoopUtils.cpp.

References llvm::LoopBase< BlockT, LoopT >::getParentLoop().

Referenced by llvm::breakLoopBackedge().

◆ hasHardUserWithinLoop()

static bool hasHardUserWithinLoop ( const Loop L,
const Instruction I 
)
static

Variable Documentation

◆ LLVMLoopDisableLICM

const char* LLVMLoopDisableLICM = "llvm.licm.disable"
static

Definition at line 60 of file LoopUtils.cpp.

Referenced by llvm::hasDisableLICMTransformsHint().

◆ LLVMLoopDisableNonforced

const char* LLVMLoopDisableNonforced = "llvm.loop.disable_nonforced"
static

Definition at line 59 of file LoopUtils.cpp.

Referenced by llvm::hasDisableAllTransformsHint().