[Attributor] Allow to delete (assume) intrinsics outside the SCC
authorJohannes Doerfert <johannes@jdoerfert.de>
Tue, 24 Jan 2023 03:40:17 +0000 (19:40 -0800)
committerJohannes Doerfert <johannes@jdoerfert.de>
Tue, 24 Jan 2023 04:32:07 +0000 (20:32 -0800)
llvm/lib/Transforms/IPO/Attributor.cpp

index ee70a39..b9134ce 100644 (file)
@@ -2354,7 +2354,7 @@ ChangeStatus Attributor::cleanupIR() {
   for (const auto &V : ToBeDeletedInsts) {
     if (Instruction *I = dyn_cast_or_null<Instruction>(V)) {
       if (auto *CB = dyn_cast<CallBase>(I)) {
-        assert(isRunOn(*I->getFunction()) &&
+        assert((isa<IntrinsicInst>(CB) || isRunOn(*I->getFunction())) &&
                "Cannot delete an instruction outside the current SCC!");
         if (!isa<IntrinsicInst>(CB))
           Configuration.CGUpdater.removeCallSite(*CB);