|
LLVM
10.0.0
|
#include "llvm/Analysis/MustExecute.h"#include "llvm/ADT/PostOrderIterator.h"#include "llvm/Analysis/CFG.h"#include "llvm/Analysis/InstructionSimplify.h"#include "llvm/Analysis/LoopInfo.h"#include "llvm/Analysis/Passes.h"#include "llvm/Analysis/PostDominators.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/IR/AssemblyAnnotationWriter.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/InstIterator.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/Module.h"#include "llvm/InitializePasses.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/FormattedStream.h"#include "llvm/Support/raw_ostream.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "must-execute" |
Functions | |
| static bool | CanProveNotTakenFirstIteration (const BasicBlock *ExitBlock, const DominatorTree *DT, const Loop *CurLoop) |
| Return true if we can prove that the given ExitBlock is not reached on the first iteration of the given loop. More... | |
| static void | collectTransitivePredecessors (const Loop *CurLoop, const BasicBlock *BB, SmallPtrSetImpl< const BasicBlock *> &Predecessors) |
Collect all blocks from CurLoop which lie on all possible paths from the header of CurLoop (inclusive) to BB (exclusive) into the set Predecessors. More... | |
| INITIALIZE_PASS_BEGIN (MustExecutePrinter, "print-mustexecute", "Instructions which execute on loop entry", false, true) INITIALIZE_PASS_END(MustExecutePrinter | |
| INITIALIZE_PASS_BEGIN (MustBeExecutedContextPrinter, "print-must-be-executed-contexts", "print the must-be-executed-contexed for all instructions", false, true) INITIALIZE_PASS_END(MustBeExecutedContextPrinter | |
| static bool | isMustExecuteIn (const Instruction &I, Loop *L, DominatorTree *DT) |
| static bool | maybeEndlessLoop (const Loop &L) |
Return true if L might be an endless loop. More... | |
| static bool | mayContainIrreducibleControl (const Function &F, const LoopInfo *LI) |
| template<typename K , typename V , typename FnTy , typename... ArgsTy> | |
| static V | getOrCreateCachedOptional (K Key, DenseMap< K, Optional< V >> &Map, FnTy &&Fn, ArgsTy &&... args) |
Lookup Key in Map and return the result, potentially after initializing the optional through Fn(args). More... | |
Variables | |
| mustexecute | |
| print Instructions which execute on loop | entry |
| print Instructions which execute on loop | false |
| print must be executed | contexts |
| print must be executed print the must be executed contexed for all | instructions |
| #define DEBUG_TYPE "must-execute" |
Definition at line 29 of file MustExecute.cpp.
|
static |
Return true if we can prove that the given ExitBlock is not reached on the first iteration of the given loop.
That is, the backedge of the loop must be executed before the ExitBlock is executed in any dynamic execution trace.
Definition at line 116 of file MustExecute.cpp.
References assert(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::dyn_cast(), and llvm::BasicBlock::getSinglePredecessor().
Referenced by llvm::LoopSafetyInfo::allLoopPathsLeadToBlock().
|
static |
Collect all blocks from CurLoop which lie on all possible paths from the header of CurLoop (inclusive) to BB (exclusive) into the set Predecessors.
If BB is the header, Predecessors will be empty.
Definition at line 159 of file MustExecute.cpp.
References assert(), llvm::LoopBase< BlockT, LoopT >::contains(), llvm::SmallVectorBase::empty(), llvm::SmallPtrSetImplBase::empty(), llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::SmallVectorImpl< T >::pop_back_val(), llvm::predecessors(), and llvm::SmallVectorTemplateBase< T >::push_back().
Referenced by llvm::LoopSafetyInfo::allLoopPathsLeadToBlock(), and llvm::ICFLoopSafetyInfo::doesNotWriteMemoryBefore().
|
static |
Lookup Key in Map and return the result, potentially after initializing the optional through Fn(args).
Definition at line 490 of file MustExecute.cpp.
References llvm::Optional< T >::getValue(), and llvm::Optional< T >::hasValue().
Referenced by llvm::MustBeExecutedContextExplorer::findForwardJoinPoint().
| INITIALIZE_PASS_BEGIN | ( | MustExecutePrinter | , |
| "print-mustexecute" | , | ||
| "Instructions which execute on loop entry" | , | ||
| false | , | ||
| true | |||
| ) |
Referenced by llvm::createMustExecutePrinter(), and llvm::ICFLoopSafetyInfo::doesNotWriteMemoryBefore().
| INITIALIZE_PASS_BEGIN | ( | MustBeExecutedContextPrinter | , |
| "print-must-be-executed-contexts" | , | ||
| "print the must-be-executed-contexed for all instructions" | , | ||
| false | , | ||
| true | |||
| ) |
|
static |
Definition at line 392 of file MustExecute.cpp.
References llvm::SimpleLoopSafetyInfo::computeLoopSafetyInfo(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::count(), llvm::dbgs(), F(), first, llvm::LoopInfoBase< BlockT, LoopT >::getLoopFor(), llvm::LoopBase< BlockT, LoopT >::getParentLoop(), I, llvm::instructions(), llvm::SimpleLoopSafetyInfo::isGuaranteedToExecute(), llvm::isGuaranteedToExecuteForEveryIteration(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::lookup(), Loops, llvm::Function::print(), and runOnFunction().
Return true if L might be an endless loop.
Definition at line 470 of file MustExecute.cpp.
References llvm::LoopBase< BlockT, LoopT >::getHeader(), llvm::BasicBlock::getParent(), and llvm::Function::hasFnAttribute().
Referenced by llvm::MustBeExecutedContextExplorer::findForwardJoinPoint().
Definition at line 478 of file MustExecute.cpp.
References llvm::containsIrreducibleCFG().
Referenced by llvm::MustBeExecutedContextExplorer::findForwardJoinPoint().
| print must be executed contexts |
Definition at line 349 of file MustExecute.cpp.
| print Instructions which execute on loop entry |
Definition at line 334 of file MustExecute.cpp.
Referenced by allPhiOperandsUndefined(), llvm::RegionBase< RegionTraits< Function > >::clearNodeCache(), llvm::RegionBase< RegionTraits< Function > >::contains(), llvm::FileCollector::copyFiles(), llvm::ImutAVLFactory< ImutInfo >::getCanonicalTree(), llvm::RegionBase< RegionTraits< Function > >::getEnteringBlock(), llvm::object::ExportDirectoryEntryRef::getExportRVA(), llvm::RegionBase< RegionTraits< Function > >::getNameStr(), llvm::RegionBase< RegionTraits< Function > >::replaceEntry(), llvm::RegionInfoBase< RegionTraits< Function > >::updateRegionTree(), llvm::sampleprof::SampleProfileWriterCompactBinary::writeFuncOffsetTable(), and llvm::sampleprof::SampleProfileWriterExtBinary::writeSample().
Definition at line 334 of file MustExecute.cpp.
Definition at line 349 of file MustExecute.cpp.
Referenced by llvm::StackSafetyInfo::FunctionInfo::FunctionInfo().
| print mustexecute |
Definition at line 334 of file MustExecute.cpp.
1.8.13