25#define DEBUG_TYPE "bpf-ir-peephole"
31static bool BPFIRPeepholeImpl(
Function &
F) {
60 if (
auto *
II = dyn_cast<IntrinsicInst>(&
I)) {
61 if (
II->getIntrinsicID() != Intrinsic::stacksave)
63 if (!
II->hasOneUser())
65 auto *Inst = cast<Instruction>(*
II->user_begin());
69 Inst->eraseFromParent();
74 if (
auto *LD = dyn_cast<LoadInst>(&
I)) {
75 if (!LD->hasOneUser())
77 auto *
II = dyn_cast<IntrinsicInst>(*LD->user_begin());
80 if (
II->getIntrinsicID() != Intrinsic::stackrestore)
85 II->eraseFromParent();
Module.h This file contains the declarations for the Module class.
uint64_t IntrinsicInst * II
This header defines various interfaces for pass management in LLVM.
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.