|
LLVM
4.0.0
|
This file implements the new LLVM's Global Value Numbering pass. More...
#include "llvm/Transforms/Scalar/NewGVN.h"#include "llvm/ADT/BitVector.h"#include "llvm/ADT/DenseMap.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/DepthFirstIterator.h"#include "llvm/ADT/Hashing.h"#include "llvm/ADT/MapVector.h"#include "llvm/ADT/PostOrderIterator.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/ADT/SmallSet.h"#include "llvm/ADT/SparseBitVector.h"#include "llvm/ADT/Statistic.h"#include "llvm/ADT/TinyPtrVector.h"#include "llvm/Analysis/AliasAnalysis.h"#include "llvm/Analysis/AssumptionCache.h"#include "llvm/Analysis/CFG.h"#include "llvm/Analysis/CFGPrinter.h"#include "llvm/Analysis/ConstantFolding.h"#include "llvm/Analysis/GlobalsModRef.h"#include "llvm/Analysis/InstructionSimplify.h"#include "llvm/Analysis/Loads.h"#include "llvm/Analysis/MemoryBuiltins.h"#include "llvm/Analysis/MemoryDependenceAnalysis.h"#include "llvm/Analysis/MemoryLocation.h"#include "llvm/Analysis/PHITransAddr.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/GlobalVariable.h"#include "llvm/IR/IRBuilder.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/Metadata.h"#include "llvm/IR/PatternMatch.h"#include "llvm/IR/PredIteratorCache.h"#include "llvm/IR/Type.h"#include "llvm/Support/Allocator.h"#include "llvm/Support/CommandLine.h"#include "llvm/Support/Debug.h"#include "llvm/Transforms/Scalar.h"#include "llvm/Transforms/Scalar/GVNExpression.h"#include "llvm/Transforms/Utils/BasicBlockUtils.h"#include "llvm/Transforms/Utils/Local.h"#include "llvm/Transforms/Utils/MemorySSA.h"#include "llvm/Transforms/Utils/SSAUpdater.h"#include <unordered_map>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| struct | CongruenceClass |
| struct | llvm::DenseMapInfo< const Expression * > |
| class | NewGVN |
| struct | NewGVN::ValueDFS |
Namespaces | |
| llvm | |
| Compute iterated dominance frontiers using a linear time algorithm. | |
| llvm::GVNExpression | |
Macros | |
| #define | DEBUG_TYPE "newgvn" |
Functions | |
| STATISTIC (NumGVNInstrDeleted,"Number of instructions deleted") | |
| STATISTIC (NumGVNBlocksDeleted,"Number of blocks deleted") | |
| STATISTIC (NumGVNOpsSimplified,"Number of Expressions simplified") | |
| STATISTIC (NumGVNPhisAllSame,"Number of PHIs whos arguments are all the same") | |
| STATISTIC (NumGVNMaxIterations,"Maximum Number of iterations it took to converge GVN") | |
| STATISTIC (NumGVNLeaderChanges,"Number of leader changes") | |
| STATISTIC (NumGVNSortedLeaderChanges,"Number of sorted leader changes") | |
| STATISTIC (NumGVNAvoidedSortedLeaderChanges,"Number of avoided sorted leader changes") | |
| STATISTIC (NumGVNNotMostDominatingLeader,"Number of times a member dominated it's new classes' leader") | |
| template<typename T > | |
| static bool | equalsLoadStoreHelper (const T &LHS, const Expression &RHS) |
| static std::string | getBlockName (const BasicBlock *B) |
| bool | hasMemberOtherThanUs (const CongruenceClass *CC, Instruction *I) |
| static bool | alwaysAvailable (Value *V) |
| static BasicBlock * | getBlockForValue (Value *V) |
| static void | patchReplacementInstruction (Instruction *I, Value *Repl) |
| static void | patchAndReplaceAllUsesWith (Instruction *I, Value *Repl) |
This file implements the new LLVM's Global Value Numbering pass.
GVN partitions values computed by a function into congruence classes. Values ending up in the same congruence class are guaranteed to be the same for every execution of the program. In that respect, congruency is a compile-time approximation of equivalence of values at runtime. The algorithm implemented here uses a sparse formulation and it's based on the ideas described in the paper: "A Sparse Algorithm for Predicated Global Value Numbering" from Karthik Gargi.
Definition in file NewGVN.cpp.
| #define DEBUG_TYPE "newgvn" |
Definition at line 76 of file NewGVN.cpp.
Definition at line 1820 of file NewGVN.cpp.
|
static |
Definition at line 375 of file NewGVN.cpp.
References L.
Referenced by llvm::GVNExpression::LoadExpression::equals(), and llvm::GVNExpression::StoreExpression::equals().
|
static |
Definition at line 1825 of file NewGVN.cpp.
References llvm::Instruction::getParent().
|
static |
Definition at line 398 of file NewGVN.cpp.
Referenced by NewGVN::runGVN().
| bool hasMemberOtherThanUs | ( | const CongruenceClass * | CC, |
| Instruction * | I | ||
| ) |
Definition at line 735 of file NewGVN.cpp.
References llvm::SmallPtrSetImpl< PtrType >::count(), CongruenceClass::Members, and CongruenceClass::StoreCount.
|
static |
Definition at line 1961 of file NewGVN.cpp.
References patchReplacementInstruction(), and llvm::Value::replaceAllUsesWith().
|
static |
Definition at line 1933 of file NewGVN.cpp.
References llvm::Instruction::andIRFlags(), llvm::combineMetadata(), llvm::dyn_cast(), I, llvm::LLVMContext::MD_alias_scope, llvm::LLVMContext::MD_fpmath, llvm::LLVMContext::MD_invariant_group, llvm::LLVMContext::MD_invariant_load, llvm::LLVMContext::MD_noalias, llvm::LLVMContext::MD_range, and llvm::LLVMContext::MD_tbaa.
Referenced by patchAndReplaceAllUsesWith().
| STATISTIC | ( | NumGVNInstrDeleted | , |
| "Number of instructions deleted" | |||
| ) |
| STATISTIC | ( | NumGVNBlocksDeleted | , |
| "Number of blocks deleted" | |||
| ) |
| STATISTIC | ( | NumGVNOpsSimplified | , |
| "Number of Expressions simplified" | |||
| ) |
| STATISTIC | ( | NumGVNPhisAllSame | , |
| "Number of PHIs whos arguments are all the same" | |||
| ) |
| STATISTIC | ( | NumGVNMaxIterations | , |
| "Maximum Number of iterations it took to converge GVN" | |||
| ) |
| STATISTIC | ( | NumGVNLeaderChanges | , |
| "Number of leader changes" | |||
| ) |
| STATISTIC | ( | NumGVNSortedLeaderChanges | , |
| "Number of sorted leader changes" | |||
| ) |
| STATISTIC | ( | NumGVNAvoidedSortedLeaderChanges | , |
| "Number of avoided sorted leader changes" | |||
| ) |
| STATISTIC | ( | NumGVNNotMostDominatingLeader | , |
| "Number of times a member dominated it's new classes' leader" | |||
| ) |
1.8.6