@@ -33,6 +33,80 @@ cc_test(
3333 ],
3434)
3535
36+ cc_library (
37+ name = "inline_advisor_plugin" ,
38+ srcs = glob (["Analysis/InlineAdvisorPlugin/*.cpp" ]),
39+ deps = [
40+ "//llvm:Analysis" ,
41+ "//llvm:Core" ,
42+ "//llvm:Passes" ,
43+ "//llvm:Support" ,
44+ ],
45+ )
46+
47+ cc_shared_library (
48+ name = "inline_advisor_plugin_shared" ,
49+ shared_lib_name = "InlineAdvisorPlugin.so" ,
50+ deps = [":inline_advisor_plugin" ],
51+ )
52+
53+ cc_test (
54+ name = "plugin_inline_advisor_analysis_test" ,
55+ srcs = ["Analysis/PluginInlineAdvisorAnalysisTest.cpp" ],
56+ data = [
57+ ":inline_advisor_plugin_shared" ,
58+ ],
59+ deps = [
60+ "//llvm:Analysis" ,
61+ "//llvm:AsmParser" ,
62+ "//llvm:Core" ,
63+ "//llvm:Passes" ,
64+ "//llvm:Support" ,
65+ "//llvm:TestingSupport" ,
66+ "//llvm:attributes_gen" ,
67+ "//llvm:config" ,
68+ "//third-party/unittest:gtest" ,
69+ "//third-party/unittest:gtest_main" ,
70+ ],
71+ )
72+
73+ cc_library (
74+ name = "inline_order_plugin" ,
75+ srcs = glob (["Analysis/InlineOrderPlugin/*.cpp" ]),
76+ deps = [
77+ "//llvm:Analysis" ,
78+ "//llvm:Core" ,
79+ "//llvm:Passes" ,
80+ "//llvm:Support" ,
81+ ],
82+ )
83+
84+ cc_shared_library (
85+ name = "inline_order_plugin_shared" ,
86+ shared_lib_name = "InlineOrderPlugin.so" ,
87+ deps = [":inline_order_plugin" ],
88+ )
89+
90+ cc_test (
91+ name = "plugin_inline_order_analysis_test" ,
92+ srcs = ["Analysis/PluginInlineOrderAnalysisTest.cpp" ],
93+ data = [
94+ ":inline_order_plugin_shared" ,
95+ ],
96+ deps = [
97+ "//llvm:Analysis" ,
98+ "//llvm:AsmParser" ,
99+ "//llvm:Core" ,
100+ "//llvm:Passes" ,
101+ "//llvm:Support" ,
102+ "//llvm:TestingSupport" ,
103+ "//llvm:attributes_gen" ,
104+ "//llvm:config" ,
105+ "//third-party/unittest:gtest" ,
106+ "//third-party/unittest:gtest_main" ,
107+ ],
108+ )
109+
36110cc_test (
37111 name = "analysis_tests" ,
38112 size = "small" ,
@@ -45,6 +119,12 @@ cc_test(
45119 "Analysis/TFUtilsTest.cpp" ,
46120 "Analysis/TrainingLoggerTest.cpp" ,
47121 "Analysis/MLModelRunnerTest.cpp" ,
122+ # These tests dynamically load Plugins which both pull in
123+ # llvm/lib/Analysis/ProfileSummaryInfo.cpp, which registers flags;
124+ # if built into the same cc_test target, those flags will be
125+ # registered twice and cause runtime failures.
126+ "Analysis/PluginInlineAdvisorAnalysisTest.cpp" ,
127+ "Analysis/PluginInlineOrderAnalysisTest.cpp" ,
48128 ],
49129 ),
50130 deps = [
0 commit comments