Skip to content

Commit

Permalink
[Attributor][FIX] Improve call graph updating
Browse files Browse the repository at this point in the history
If we remove a non-intrinsic instruction we need to tell the (old) call
graph about it. This caused problems with some features down the line as
they allowed to removed calls more aggressively.
  • Loading branch information
jdoerfert committed Jul 22, 2021
1 parent 94d3b59 commit 0c0eb76
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions llvm/lib/Transforms/IPO/Attributor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/NoFolder.h"
#include "llvm/IR/ValueHandle.h"
#include "llvm/IR/Verifier.h"
Expand Down Expand Up @@ -1589,9 +1590,12 @@ ChangeStatus Attributor::cleanupIR() {

for (auto &V : ToBeDeletedInsts) {
if (Instruction *I = dyn_cast_or_null<Instruction>(V)) {
if (auto *CB = dyn_cast<CallBase>(I))
if (CB->isMustTailCall() && !isRunOn(*I->getFunction()))
if (auto *CB = dyn_cast<CallBase>(I)) {
if (!isRunOn(*I->getFunction()))
continue;
if (!isa<IntrinsicInst>(CB))
CGUpdater.removeCallSite(*CB);
}
I->dropDroppableUses();
CGModifiedFunctions.insert(I->getFunction());
if (!I->getType()->isVoidTy())
Expand Down

0 comments on commit 0c0eb76

Please sign in to comment.