1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[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.
This commit is contained in:
Johannes Doerfert 2021-07-16 14:14:37 -05:00
parent 54c73c71f7
commit f303e248b9

View File

@ -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())