forked from OSchip/llvm-project
BPF: fix a bug in IRPeephole pass
Commit 009f3a89d8
("BPF: remove intrindics @llvm.stacksave()
and @llvm.stackrestore()") implemented IRPeephole pass to remove
llvm.stacksave()/stackrestore() instrinsics.
Buildbot reported a failure:
UNREACHABLE executed at ../lib/IR/LegacyPassManager.cpp:1445!
which is:
llvm_unreachable("Pass modifies its input and doesn't report it");
The code has changed but the implementation didn't return true
for changing. This patch fixed this problem.
This commit is contained in:
parent
2e4e2004af
commit
e9e4fc0fd3
|
@ -30,6 +30,7 @@ namespace {
|
|||
static bool BPFIRPeepholeImpl(Function &F) {
|
||||
LLVM_DEBUG(dbgs() << "******** BPF IR Peephole ********\n");
|
||||
|
||||
bool Changed = false;
|
||||
Instruction *ToErase = nullptr;
|
||||
for (auto &BB : F) {
|
||||
for (auto &I : BB) {
|
||||
|
@ -64,6 +65,7 @@ static bool BPFIRPeepholeImpl(Function &F) {
|
|||
auto *Inst = cast<Instruction>(*Call->user_begin());
|
||||
LLVM_DEBUG(dbgs() << "Remove:"; I.dump());
|
||||
LLVM_DEBUG(dbgs() << "Remove:"; Inst->dump(); dbgs() << '\n');
|
||||
Changed = true;
|
||||
Inst->eraseFromParent();
|
||||
ToErase = &I;
|
||||
}
|
||||
|
@ -83,13 +85,14 @@ static bool BPFIRPeepholeImpl(Function &F) {
|
|||
continue;
|
||||
LLVM_DEBUG(dbgs() << "Remove:"; I.dump());
|
||||
LLVM_DEBUG(dbgs() << "Remove:"; Call->dump(); dbgs() << '\n');
|
||||
Changed = true;
|
||||
Call->eraseFromParent();
|
||||
ToErase = &I;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return Changed;
|
||||
}
|
||||
|
||||
class BPFIRPeephole final : public FunctionPass {
|
||||
|
|
Loading…
Reference in New Issue