The global state refers to the number of the nodes currently in the module, and the number of direct calls between nodes, across the module. Node counts are not a problem; edge counts are because we want strictly the kind of edges that affect inlining (direct calls), and that is not easily obtainable without iteration over the whole module. This patch avoids relying on analysis invalidation because it turned out to be too aggressive in some cases. It leverages the fact that Node objects are stable - they do not get deleted while cgscc passes are run over the module; and cgscc pass manager invariants. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D115847
24 lines
510 B
LLVM
24 lines
510 B
LLVM
; RUN: opt -passes='default<O3>,print<inline-advisor>' -training-log=/dev/null \
|
|
; RUN: -S -enable-ml-inliner=development -keep-inline-advisor-for-printing < %s 2>&1 | FileCheck %s
|
|
; REQUIRES: have_tf_api
|
|
;
|
|
; CHECK: [MLInlineAdvisor] Nodes: 3 Edges: 1
|
|
|
|
declare i32 @f1()
|
|
|
|
define i32 @f2() {
|
|
ret i32 1
|
|
}
|
|
|
|
define i32 @f3() noinline {
|
|
ret i32 2
|
|
}
|
|
|
|
define i32 @f4() {
|
|
%a = call i32 @f1()
|
|
%b = call i32 @f2()
|
|
%c = call i32 @f3()
|
|
%d = add i32 %a, %b
|
|
%e = add i32 %d, %c
|
|
ret i32 %e
|
|
} |