#include "llvm/Analysis/PHITransAddr.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
usingnamespacellvm;
static cl::opt<bool> EnableAddPhiTranslation(
"gvn-add-phi-translation", cl::init(false), cl::Hidden,
cl::desc("Enable phi-translation of add instructions"));
static bool canPHITrans(Instruction *Inst) { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void PHITransAddr::dump() const {
if (!Addr) {
dbgs() << "PHITransAddr: null\n";
return;
}
dbgs() << "PHITransAddr: " << *Addr << "\n";
for (unsigned i = 0, e = InstInputs.size(); i != e; ++i)
dbgs() << " Input #" << i << " is " << *InstInputs[i] << "\n";
}
#endif
static bool verifySubExpr(Value *Expr,
SmallVectorImpl<Instruction *> &InstInputs) { … }
bool PHITransAddr::verify() const { … }
bool PHITransAddr::isPotentiallyPHITranslatable() const { … }
static void RemoveInstInputs(Value *V,
SmallVectorImpl<Instruction*> &InstInputs) { … }
Value *PHITransAddr::translateSubExpr(Value *V, BasicBlock *CurBB,
BasicBlock *PredBB,
const DominatorTree *DT) { … }
Value *PHITransAddr::translateValue(BasicBlock *CurBB, BasicBlock *PredBB,
const DominatorTree *DT,
bool MustDominate) { … }
Value *
PHITransAddr::translateWithInsertion(BasicBlock *CurBB, BasicBlock *PredBB,
const DominatorTree &DT,
SmallVectorImpl<Instruction *> &NewInsts) { … }
Value *PHITransAddr::insertTranslatedSubExpr(
Value *InVal, BasicBlock *CurBB, BasicBlock *PredBB,
const DominatorTree &DT, SmallVectorImpl<Instruction *> &NewInsts) { … }