Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions utils/bazel/llvm-project-overlay/llvm/unittests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,80 @@ cc_test(
],
)

cc_library(
name = "inline_advisor_plugin",
srcs = glob(["Analysis/InlineAdvisorPlugin/*.cpp"]),
deps = [
"//llvm:Analysis",
"//llvm:Core",
"//llvm:Passes",
"//llvm:Support",
],
Comment on lines +39 to +44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should be handled as "interface libs". Plugins shouldn't link them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plugins shouldn't link them.

Actually, I just realized this is why I had to use separate targets for the plugin tests; if they are not linked into the plugins, there would be no duplicate flag registrations.

The right way to do this, is probably to introduce header-only versions of these four dependencies, and use them to build the plugin. But since these are just tests, I guess we are somewhat fine here...?

)

cc_shared_library(
name = "inline_advisor_plugin_shared",
shared_lib_name = "InlineAdvisorPlugin.so",
deps = [":inline_advisor_plugin"],
)

cc_test(
name = "plugin_inline_advisor_analysis_test",
srcs = ["Analysis/PluginInlineAdvisorAnalysisTest.cpp"],
data = [
":inline_advisor_plugin_shared",
],
deps = [
"//llvm:Analysis",
"//llvm:AsmParser",
"//llvm:Core",
"//llvm:Passes",
"//llvm:Support",
"//llvm:TestingSupport",
"//llvm:attributes_gen",
"//llvm:config",
"//third-party/unittest:gtest",
"//third-party/unittest:gtest_main",
],
)

cc_library(
name = "inline_order_plugin",
srcs = glob(["Analysis/InlineOrderPlugin/*.cpp"]),
deps = [
"//llvm:Analysis",
"//llvm:Core",
"//llvm:Passes",
"//llvm:Support",
],
)

cc_shared_library(
name = "inline_order_plugin_shared",
shared_lib_name = "InlineOrderPlugin.so",
deps = [":inline_order_plugin"],
)

cc_test(
name = "plugin_inline_order_analysis_test",
srcs = ["Analysis/PluginInlineOrderAnalysisTest.cpp"],
data = [
":inline_order_plugin_shared",
],
deps = [
"//llvm:Analysis",
"//llvm:AsmParser",
"//llvm:Core",
"//llvm:Passes",
"//llvm:Support",
"//llvm:TestingSupport",
"//llvm:attributes_gen",
"//llvm:config",
"//third-party/unittest:gtest",
"//third-party/unittest:gtest_main",
],
)

cc_test(
name = "analysis_tests",
size = "small",
Expand All @@ -45,6 +119,12 @@ cc_test(
"Analysis/TFUtilsTest.cpp",
"Analysis/TrainingLoggerTest.cpp",
"Analysis/MLModelRunnerTest.cpp",
# These tests dynamically load Plugins which both pull in
# llvm/lib/Analysis/ProfileSummaryInfo.cpp, which registers flags;
# if built into the same cc_test target, those flags will be
# registered twice and cause runtime failures.
"Analysis/PluginInlineAdvisorAnalysisTest.cpp",
"Analysis/PluginInlineOrderAnalysisTest.cpp",
Comment on lines +122 to +127
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me investigate further later,

],
),
deps = [
Expand Down
Loading