This is an archive of the discontinued LLVM Phabricator instance.

[CMake][SingleSource] Fix compile with profile generation
ClosedPublic

Authored by aidengrossman on Jun 20 2022, 2:03 PM.

Details

Summary

Currently, when compiling with the CMake flag
TEST_SUITE_PROFILE_GENERATE set to ON, compare-fp-3.c fails to
compile as clang tries to insert instrumentation on the functions
that are supposed to get optimized out. This commit fixes this by
adding references to these functions when profile generation is
turned on so that the test suite builds without linking errors.

Diff Detail

Repository
rT test-suite

Event Timeline

aidengrossman created this revision.Jun 20 2022, 2:03 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 20 2022, 2:03 PM
Herald added a subscriber: mgorny. · View Herald Transcript
aidengrossman requested review of this revision.Jun 20 2022, 2:03 PM
aidengrossman added reviewers: lenary, vsk, MatzeB.EditedJun 20 2022, 2:14 PM

There seems to be an underlying issue in the compiler when compiling with instrumentation as identified in https://groups.google.com/g/llvm-dev/c/180LAuFPfKs. This patch is a workaround for this issue for people compiling the test suite with PGO instrumentation enabled and not just the TEST_SUITE_BENCHMARKING_ONLY set to ON. Let me know if there is a more elegant/preferred way of solving this within the test suite (Or if this patch is even desired given the fairly atypical use case of PGO with the entire test suite).
9(Reviewers pinged for commits in relevant areas (PGO CMake implementation/gcc-c-torture suite integration))

MatzeB added a comment.EditedJun 20 2022, 2:22 PM

Could you instead exclude the test in the SingleSource/Regression/C/gcc-c-torture/execute/ieee/CMakeLists.txt file? Given that this is source from the gcc torture suite that we may want to update again in the future, it's probably best if we can avoid custom changes in the source.

aidengrossman updated this revision to Diff 438480.EditedJun 20 2022, 2:44 PM

Fixed modification of gcc-c-torture suite source files by just excluding the test in the relevant CMakeLists.txt file.

MatzeB accepted this revision.Jun 20 2022, 2:49 PM

LGTM

SingleSource/Regression/C/gcc-c-torture/execute/ieee/CMakeLists.txt
38

Should this also be excluded for PROFILE_USE for consistency?

No strong opinion though, whatever works.

This revision is now accepted and ready to land.Jun 20 2022, 2:49 PM

Made behavior consistent between TEST_SUITE_PROFILE_GENERATE and TEST_SUITE_PROFILE_USE.

aidengrossman marked an inline comment as done.Jun 20 2022, 3:00 PM

LGTM

Thank you for the quick review and sharing your expertise. Is it possible for you land this commit? I don't have push access.

lenary accepted this revision.Jun 21 2022, 1:41 AM

Thanks for doing this change in the CMakeLists - it's right we don't want to change the gcc torture suite sources, if possible.

I don't have commit access to the llvm-test-suite repository. Is it possible for someone to push this commit to the test suite repository? My details for the git commit authorship:
Aiden Grossman
agrossman154 at yahoo dot com

This revision was automatically updated to reflect the committed changes.