Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mlir] Don't inline calls from dead SCCs
During iterative inlining of the functions in a multi-step call chain, the inliner could add the same call operation several times to the worklist, which led to use-after-free when this op was considered more than once. Closes #52887. Reviewed By: wsmoses Differential Revision: https://reviews.llvm.org/D116820
- Loading branch information
Showing
2 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// RUN: mlir-opt -inline %s | FileCheck %s | ||
|
||
// This could crash the inliner, make sure it does not. | ||
|
||
func @A() { | ||
call @B() { inA } : () -> () | ||
return | ||
} | ||
|
||
func @B() { | ||
call @E() : () -> () | ||
return | ||
} | ||
|
||
func @C() { | ||
call @D() : () -> () | ||
return | ||
} | ||
|
||
func private @D() { | ||
call @B() { inD } : () -> () | ||
return | ||
} | ||
|
||
func @E() { | ||
call @fabsf() : () -> () | ||
return | ||
} | ||
|
||
func private @fabsf() | ||
|
||
// CHECK: func @A() { | ||
// CHECK: call @fabsf() : () -> () | ||
// CHECK: return | ||
// CHECK: } | ||
// CHECK: func @B() { | ||
// CHECK: call @fabsf() : () -> () | ||
// CHECK: return | ||
// CHECK: } | ||
// CHECK: func @C() { | ||
// CHECK: call @fabsf() : () -> () | ||
// CHECK: return | ||
// CHECK: } | ||
// CHECK: func @E() { | ||
// CHECK: call @fabsf() : () -> () | ||
// CHECK: return | ||
// CHECK: } | ||
// CHECK: func private @fabsf() |