#include "llvm/Transforms/Utils/MoveAutoInit.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Transforms/Utils.h"
#include "llvm/Transforms/Utils/LoopUtils.h"
usingnamespacellvm;
#define DEBUG_TYPE …
STATISTIC(NumMoved, "Number of instructions moved");
static cl::opt<unsigned> MoveAutoInitThreshold(
"move-auto-init-threshold", cl::Hidden, cl::init(128),
cl::desc("Maximum instructions to analyze per moved initialization"));
static bool hasAutoInitMetadata(const Instruction &I) { … }
static std::optional<MemoryLocation> writeToAlloca(const Instruction &I) { … }
static BasicBlock *usersDominator(const MemoryLocation &ML, Instruction *I,
DominatorTree &DT, MemorySSA &MSSA) { … }
static bool runMoveAutoInit(Function &F, DominatorTree &DT, MemorySSA &MSSA) { … }
PreservedAnalyses MoveAutoInitPass::run(Function &F,
FunctionAnalysisManager &AM) { … }