-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[clang][flang] Support -time in both clang and flang #109165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+93
−0
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
11ee94e
[clang][flang] Support -time in both clang and flang
29dac37
Disable the Fortran test on Windows because it does not produce any o…
e7e79c4
Address reviewer comments. Remove unnecessary -O3 flag in test run li…
517550d
Address reviewer comments. Same fixes to Fortran.
c571747
Add explicit target triple and enable the tests only on Linux on x86_64.
tarunprabhu 61e51a7
Address reviewer comments.
tarunprabhu 60b63dc
Address reviewer comments. Make output compatible with GCC
tarunprabhu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // The -time option prints timing information for the various subcommands in a | ||
| // format similar to that used by gcc. When compiling and linking, this will | ||
| // include the time to call clang-${LLVM_VERSION_MAJOR} and the linker. Since | ||
| // the name of the linker could vary across platforms, and name of the compiler | ||
| // could be something different, just check that whatever is printed to stderr | ||
| // looks like timing information. | ||
|
|
||
| // Ideally, this should be tested on various platforms, but that requires the | ||
| // the full toolchain, including a linker to be present. The initial author of | ||
| // the test only had access to Linux on x86 which is why this is only enabled | ||
| // there. More platforms ought to be added if possible. | ||
|
|
||
| // REQUIRES: x86-registered-target | ||
| // REQUIRES: x86_64-linux | ||
|
|
||
| // RUN: %clang --target=x86_64-pc-linux -time -c -o /dev/null %s 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=COMPILE-ONLY | ||
| // RUN: %clang --target=x86_64-pc-linux -time -S -emit-llvm -o /dev/null %s 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=COMPILE-ONLY | ||
| // RUN: %clang --target=x86_64-pc-linux -time -S -o /dev/null %s 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=COMPILE-ONLY | ||
| // RUN: %clang --target=x86_64-pc-linux -time -o /dev/null %s 2>&1 \ | ||
| // RUN: | FileCheck %s --check-prefix=COMPILE-AND-LINK | ||
|
|
||
| // COMPILE-ONLY: # {{.+}} {{[0-9]+(.[0-9]+)?}} {{[0-9]+(.[0-9]+)?}} | ||
tarunprabhu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // COMPILE-ONLY-NOT: {{.}} | ||
|
|
||
| // COMPILE-AND-LINK: # {{.+}} {{[0-9]+(.[0-9]+)?}} {{[0-9]+(.[0-9]+)?}} | ||
| // COMPILE-AND-LINK: # {{.+}} {{[0-9]+(.[0-9]+)?}} {{[0-9]+(.[0-9]+)?}} | ||
|
|
||
| int main() { | ||
| return 0; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| ! TODO: For some reason, on Windows, nothing is printed to stderr which causes | ||
| ! the checks to fail. It is not clear why this is, so disable this on Windows | ||
| ! until the root cause can be determined. | ||
| ! | ||
| ! UNSUPPORTED: system-windows | ||
|
|
||
| ! The -time option prints timing information for the various subcommands in a | ||
| ! format similar to that used by gfortran. When compiling and linking, this will | ||
| ! include the time to call flang-${LLVM_VERSION_MAJOR} and the linker. Since the | ||
| ! name of the linker could vary across platforms, and the flang name could also | ||
| ! potentially be something different, just check that whatever is printed to | ||
| ! stderr looks like timing information. | ||
|
|
||
| ! Ideally, this should be tested on various platforms, but that requires the | ||
| ! the full toolchain, including a linker to be present. The initial author of | ||
| ! the test only had access to Linux on x86 which is why this is only enabled | ||
| ! there. More platforms ought to be added if possible. | ||
|
|
||
| ! REQUIRES: x86_64-linux | ||
|
|
||
| ! RUN: %flang --target=x86_64-linux -time -c -o /dev/null %s 2>&1 \ | ||
| ! RUN: | FileCheck %s --check-prefix=COMPILE-ONLY | ||
| ! RUN: %flang --target=x86_64-linux -time -S -emit-llvm -O3 -o /dev/null %s 2>&1 \ | ||
| ! RUN: | FileCheck %s --check-prefix=COMPILE-ONLY | ||
| ! RUN: %flang --target=x86_64-linux -time -S -o /dev/null %s 2>&1 \ | ||
| ! RUN: | FileCheck %s --check-prefix=COMPILE-ONLY | ||
| ! RUN: %flang --target=x86_64-linux -time -o /dev/null %s 2>&1 \ | ||
| ! RUN: | FileCheck %s --check-prefix=COMPILE-AND-LINK | ||
|
|
||
| ! COMPILE-ONLY: # {{.+}} {{[0-9]+(.[0-9]+)?}} {{[0-9]+(.[0-9]+)?}} | ||
| ! COMPILE-ONLY-NOT: {{.}} | ||
|
|
||
| ! COMPILE-AND-LINK: # {{.+}} {{[0-9]+(.[0-9]+)?}} {{[0-9]+(.[0-9]+)?}} | ||
| ! COMPILE-AND-LINK: # {{.+}} {{[0-9]+(.[0-9]+)?}} {{[0-9]+(.[0-9]+)?}} | ||
|
|
||
| end program |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is not expected to work on Windows, then should we have CLOption and DXCOption? Or are these just added for compatibility with the previous setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any reason why it should not work on Windows. But there was a failing Windows buildkite, so I temporarily disabled the test. I will try again to see if it was a transient issue. If the issue still persists, I will add a comment indicating that the option should work on Windows, but that the original author did not have a means to test it and, therefore, disabled it. Since some of the tests require a full toolchain to be present, @MaskRay suggested being conservative about where the tests were run.
I have generally kept
CLOptionandDXCOptionwhen the original did not explicitly specify anything for compatibility.