[llvm] 0c0eb76 - [Attributor][FIX] Improve call graph updating
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 21 22:08:25 PDT 2021
Author: Johannes Doerfert
Date: 2021-07-22T00:07:56-05:00
New Revision: 0c0eb76782d5224b8d81a5afbb9a152bcf7c94c7
URL: https://github.com/llvm/llvm-project/commit/0c0eb76782d5224b8d81a5afbb9a152bcf7c94c7
DIFF: https://github.com/llvm/llvm-project/commit/0c0eb76782d5224b8d81a5afbb9a152bcf7c94c7.diff
LOG: [Attributor][FIX] Improve call graph updating
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.
Added:
Modified:
llvm/lib/Transforms/IPO/Attributor.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index c2e755ef29f9..97c585ef9117 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -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"
@@ -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())
More information about the llvm-commits
mailing list