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

[NewPM] Bail out of devirtualization wrapper if the current SCC is invalidated

The specific case that triggered this was when inlining a recursive
internal function into itself caused the recursion to go away, allowing
the inliner to mark the function as dead. The inliner marks the SCC as
invalidated but does not provide a new SCC to continue with.

This matches the implementations of ModuleToPostOrderCGSCCPassAdaptor
and CGSCCPassManager.

Fixes PR50363.

Reviewed By: asbirlea

Differential Revision: https://reviews.llvm.org/D106306
This commit is contained in:
Arthur Eubanks 2021-07-19 13:20:57 -07:00
parent 3b84d5a91c
commit 0b315633ca
2 changed files with 37 additions and 2 deletions

View File

@ -432,8 +432,13 @@ PreservedAnalyses DevirtSCCRepeatedPass::run(LazyCallGraph::SCC &InitialC,
break;
}
// Check that we didn't miss any update scenario.
assert(!UR.InvalidatedSCCs.count(C) && "Processing an invalid SCC!");
// If the CGSCC pass wasn't able to provide a valid updated SCC, the
// current SCC may simply need to be skipped if invalid.
if (UR.InvalidatedSCCs.count(C)) {
LLVM_DEBUG(dbgs() << "Skipping invalidated root or island SCC!\n");
break;
}
assert(C->begin() != C->end() && "Cannot have an empty SCC!");
// Check whether any of the handles were devirtualized.

View File

@ -0,0 +1,30 @@
; RUN: opt -passes='devirt<0>(inline)' < %s -S | FileCheck %s
; CHECK-NOT: internal
; CHECK: define void @e()
; CHECK-NOT: internal
define void @e() {
entry:
call void @b()
ret void
}
define internal void @b() {
entry:
call void @d()
call void @c()
ret void
}
define internal void @d() {
entry:
unreachable
}
define internal void @c() {
entry:
call void @b()
call void @e()
ret void
}