74 lines · plain
1; MRE for SCC splitting causing MLInlineAdvisor to lose track of edges2; foo and bar both call inlineme; inlineme calls only foo and bar3; when the foo-bar-inlineme SCC reaches the inliner, foo-bar will be split out4; leaving inlineme in the SCC. inlineme is dead, so it gets removed from the SCC5; However, MLInlineAdvisor should still track the edges of foo and bar onPassExit6; as the foo-bar SCC will be passed on to the next SCC pass in the pipeline7; and as a result could gain/lose edges before the inliner sees it again8 9; In this example if loop-unroll is ran after a mandatory inlining CGSCC pass,10; edges would increase but wouldn't be tracked11 12; REQUIRES: llvm_inliner_model_autogenerated13 14; RUN: opt -enable-ml-inliner=release -passes=inliner-ml-advisor-release \15; RUN: -keep-inline-advisor-for-printing \16; RUN: -enable-scc-inline-advisor-printing -S < %s 2>&1 | FileCheck %s17 18target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"19target triple = "x86_64-unknown-linux-gnu"20 21define internal void @_Z8inlinemei() inlinehint alwaysinline {22entry:23 %call2 = call noundef i32 @_Z3bari(i32 noundef 12321)24 %call3 = call noundef i32 @_Z3fooi(i32 noundef 12321)25 ret void26}27 28define dso_local noundef i32 @_Z3bari(i32 noundef %y) {29entry:30 call void @_Z8inlinemei()31 ret i32 %y32}33 34define dso_local noundef i32 @main(i32 noundef %argc, ptr noundef %argv) {35entry:36 %call = call noundef i32 @_Z3fooi(i32 noundef %argc)37 ret i32 %call38}39 40define dso_local noundef i32 @_Z3fooi(i32 noundef %z) {41entry:42 %a = alloca i32, align 443 br label %for.body44 45for.body:46 %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]47 %arrayidx = getelementptr inbounds i32, ptr %a, i64 %indvars.iv48 %0 = load i32, ptr %arrayidx, align 449 %inc = add nsw i32 %0, 150 store i32 %inc, ptr %arrayidx, align 451 call void @_Z8inlinemei()52 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 153 %exitcond = icmp eq i64 %indvars.iv.next, 1054 br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !555 56for.end:57 ret i32 %z58}59 60!llvm.module.flags = !{!0, !1, !2, !3, !4}61 62!0 = !{i32 1, !"wchar_size", i32 4}63!1 = !{i32 7, !"PIC Level", i32 2}64!2 = !{i32 7, !"PIE Level", i32 2}65!3 = !{i32 7, !"uwtable", i32 2}66!4 = !{i32 7, !"frame-pointer", i32 2}67!5 = !{!5, !{!"llvm.loop.disable_nonforced"}, !{!"llvm.loop.unroll.enable"}}68 69; CHECK: [MLInlineAdvisor] Nodes: 3 Edges: 5 EdgesOfLastSeenNodes: 470; CHECK: [MLInlineAdvisor] Nodes: 3 Edges: 5 EdgesOfLastSeenNodes: 471; CHECK: [MLInlineAdvisor] Nodes: 3 Edges: 5 EdgesOfLastSeenNodes: 472; CHECK: [MLInlineAdvisor] Nodes: 3 Edges: 5 EdgesOfLastSeenNodes: 473; CHECK: [MLInlineAdvisor] Nodes: 3 Edges: 5 EdgesOfLastSeenNodes: 174