23#define DEBUG_TYPE "bpf-ir-peephole"
29static bool BPFIRPeepholeImpl(
Function &
F) {
58 if (
auto *
II = dyn_cast<IntrinsicInst>(&
I)) {
59 if (
II->getIntrinsicID() != Intrinsic::stacksave)
61 if (!
II->hasOneUser())
63 auto *Inst = cast<Instruction>(*
II->user_begin());
67 Inst->eraseFromParent();
72 if (
auto *LD = dyn_cast<LoadInst>(&
I)) {
73 if (!LD->hasOneUser())
75 auto *
II = dyn_cast<IntrinsicInst>(*LD->user_begin());
78 if (
II->getIntrinsicID() != Intrinsic::stackrestore)
83 II->eraseFromParent();
This header defines various interfaces for pass management in LLVM.
uint64_t IntrinsicInst * II
A container for analyses that lazily runs them and caches their results.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
InstListType::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.