Skip to content

Conversation

@tomershafir
Copy link
Contributor

This patch adds a Clang-compatible --save-stats option, to provide an easy to use way to save LLVM statistics files when working with llc on the backend.

Like on Clang, one can specify --save-stats, --save-stats=cwd, and --save-stats=obj with the same semantics and JSON format.

The implementation uses 2 methods MaybeEnableStats and MaybeSaveStats called before and after compileModule respectively that externally own the statistics related logic, while compileModule is now required to return the resolved output filename via an output param.

Note: like on Clang, the pre-existing --stats option is not affected.

@tomershafir tomershafir marked this pull request as ready for review October 17, 2025 15:54
This patch adds a Clang-compatible `--save-stats` option, to provide an easy to use way to save LLVM statistics files when working with llc on the backend.

Like on Clang, one can specify `--save-stats`, `--save-stats=cwd`, and `--save-stats=obj` with the same semantics and JSON format.

The implementation uses 2 methods `MaybeEnableStats` and `MaybeSaveStats` called before and after `compileModule` respectively that externally own the statistics related logic, while `compileModule` is now required to return the resolved output filename via an output param.

Note: like on Clang, the pre-existing `--stats` option is not affected.
Copy link
Member

@dtcxzyw dtcxzyw left a comment

Choose a reason for hiding this comment

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

LG

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

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

If we decide to add this flag, I think it should be consistent across all tools that have a --stats option.

@MatzeB
Copy link
Contributor

MatzeB commented Oct 21, 2025

Feels somewhat odd that llc would have an option now but other tools like opt do not...

@tomershafir
Copy link
Contributor Author

I planned to add it to opt in a followup patch

@tomershafir
Copy link
Contributor Author

I see also lli and tblgen have --stats, which should be handled in followups.

@MatzeB
Copy link
Contributor

MatzeB commented Oct 21, 2025

Given --stats is defined in lib/Support/Statistics.cpp you kinda get a --stats switch for every tool linking against libSupport which is about all of them... Can't you define the new option there so it is available everywhere?

@MatzeB
Copy link
Contributor

MatzeB commented Oct 21, 2025

Would a simpler version work that just takes a filename instead of all the logic with cwd / obj[1]

[1] I think the logic kinda makes sense for the clang driver which naturally does this sort of transformation and filename construction all the time; but for these small developers tools within LLVM it seems overkill...

@MatzeB
Copy link
Contributor

MatzeB commented Oct 21, 2025

Reading the existing code you can already do: --stats --stats-json --info-output-file=xxxx.json so do we even need a new option?

(Admittedly the existing flags are kinda hard to discover and don't have great names; but oh well...)

@tomershafir
Copy link
Contributor Author

  • I think having ad hoc --save-stats gives you a more structured approach. A generic output like --info-output-file=xxxx.json can mix other streams which are not statistics too, then you'll have to parse it somehow.

  • Adding it to libSupport would require some API so each tool submits an output filename, as each resolves it independently and the statistics object is static. So we'll need to inject it out of order and independently of statistics options, which I think can be a bit odd, but tolerable to reduce code duplication.

  • I think --save-stats=obj is very useful for big projects to have file tree context, so Im against dropping this one. On the other hand, dropping cwd would break compatibility with Clang where its the default. So I think it may be better to keep it as is, given that its pretty simple logic.

@dtcxzyw
Copy link
Member

dtcxzyw commented Oct 22, 2025

I think having ad hoc --save-stats gives you a more structured approach. A generic output like --info-output-file=xxxx.json can mix other streams which are not statistics too, then you'll have to parse it somehow.

Agree. In my downstream project I have to do the extra substr to get the JSON body.

Adding it to libSupport would require some API so each tool submits an output filename, as each resolves it independently and the statistics object is static. So we'll need to inject it out of order and independently of statistics options, which I think can be a bit odd, but tolerable to reduce code duplication.

Adding this option to opt is enough. I don't see the value of putting the logic in libSupport. A bit of code duplication should be acceptable.

@MatzeB
Copy link
Contributor

MatzeB commented Oct 22, 2025

A generic output like --info-output-file=xxxx.json can mix other streams which are not statistics too, then you'll have to parse it somehow.

Not sure what you are getting at here; there's only timers (Support/Timer.h) and statistics (Support/Statistics.h) data in there and it's always json when you use the json switch; and in my mind timers and statistics just differ in how they get collected the result is a metric number either way. So feels natural to me to have them in the same file and process them with the same tools.

In my downstream project I have to do the extra substr to get the JSON body.

When using --info-output-file= the whole output is JSON that you could easily parse in python, no?

I'm not convinced the code duplication is that good an idea, so -1 from me. But not gonna block this if people think that =obj logic to deduce the statistics filename from the output filename is all that valuable...

@tomershafir
Copy link
Contributor Author

tomershafir commented Oct 22, 2025

Adding this option to opt is enough. I don't see the value of putting the logic in libSupport. A bit of code duplication should be acceptable.

Agree. I think llc and opt are enough. Adding it to libSupport can complicate things. It would also require migrating the Clang options there and couple Clang to these options.

But not gonna block this if people think that =obj logic to deduce the statistics filename from the output filename is all that valuable...

I think =obj is valuable, it gives you more context for analysis and disambiguates modules rather than a flat directory, like when you build LLVM which has many modules.

@tomershafir tomershafir requested a review from jroelofs October 28, 2025 09:45
@github-actions
Copy link

github-actions bot commented Oct 28, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@fhahn fhahn left a comment

Choose a reason for hiding this comment

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

Just to mention another possible alternative, @tobias-stadler has been working on emitting statistics for each function as a remark, which would allow for higher granularity.

@tomershafir
Copy link
Contributor Author

Just to mention another possible alternative, @tobias-stadler has been working on emitting statistics for each function as a remark, which would allow for higher granularity.

I think this can be viewed as an implementation detail here, which would still require LLVM statistics semantics as described here on top, so I dont think it should block this enhancement.

@tomershafir
Copy link
Contributor Author

Since there is no strong resistance or further inputs, going to merge this soon

@tomershafir tomershafir merged commit 96a5289 into llvm:main Nov 9, 2025
11 checks passed
@tomershafir tomershafir deleted the llc-save-stats branch November 9, 2025 12:11
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-ubuntu-fast running on sie-linux-worker while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/39698

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llc/Output/save-stats.ll.tmp.s /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/tools/llc/save-stats.ll && cat /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llc/Output/save-stats.ll.tmp.stats | /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/tools/llc/save-stats.ll
# executed command: /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/test/tools/llc/Output/save-stats.ll.tmp.s /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/test/tools/llc/save-stats.ll
# .---command stderr------------
# | /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/27/builds/18682

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llc/Output/save-stats.ll.tmp.s /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/tools/llc/save-stats.ll && cat /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llc/Output/save-stats.ll.tmp.stats | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/FileCheck /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/tools/llc/save-stats.ll
# executed command: /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/test/tools/llc/Output/save-stats.ll.tmp.s /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/test/tools/llc/save-stats.ll
# .---command stderr------------
# | /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/bin/llc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building llvm at step 8 "Add check check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/16966

Here is the relevant piece of the build log for the reference
Step 8 (Add check check-llvm) failure: test (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/test/tools/llc/Output/save-stats.ll.tmp.s /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/tools/llc/save-stats.ll && cat /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/test/tools/llc/Output/save-stats.ll.tmp.stats | /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/FileCheck /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/tools/llc/save-stats.ll
# executed command: /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/test/tools/llc/Output/save-stats.ll.tmp.s /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/test/tools/llc/save-stats.ll
# .---command stderr------------
# | /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/bin/llc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder arc-builder running on arc-worker while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/24601

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/buildbot/worker/arc-folder/build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /buildbot/worker/arc-folder/build/test/tools/llc/Output/save-stats.ll.tmp.s /buildbot/worker/arc-folder/llvm-project/llvm/test/tools/llc/save-stats.ll && cat /buildbot/worker/arc-folder/build/test/tools/llc/Output/save-stats.ll.tmp.stats | /buildbot/worker/arc-folder/build/bin/FileCheck /buildbot/worker/arc-folder/llvm-project/llvm/test/tools/llc/save-stats.ll
# executed command: /buildbot/worker/arc-folder/build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /buildbot/worker/arc-folder/build/test/tools/llc/Output/save-stats.ll.tmp.s /buildbot/worker/arc-folder/llvm-project/llvm/test/tools/llc/save-stats.ll
# .---command stderr------------
# | /buildbot/worker/arc-folder/build/bin/llc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/23797

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/test/tools/llc/Output/save-stats.ll.tmp.s /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llc/save-stats.ll && cat /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/test/tools/llc/Output/save-stats.ll.tmp.stats | /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llc/save-stats.ll
# executed command: /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/test/tools/llc/Output/save-stats.ll.tmp.s /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/tools/llc/save-stats.ll
# .---command stderr------------
# | /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-win running on sie-win-worker while building llvm at step 4 "clean-build-dir".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/46/builds/26069

Here is the relevant piece of the build log for the reference
Step 4 (clean-build-dir) failure: Delete failed. (failure)
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
z:\b\llvm-clang-x86_64-sie-win\build\bin\llc.exe -mtriple=arm64-apple-macosx --save-stats=obj -o Z:\b\llvm-clang-x86_64-sie-win\build\test\tools\llc\Output\save-stats.ll.tmp.s Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llc\save-stats.ll && cat Z:\b\llvm-clang-x86_64-sie-win\build\test\tools\llc\Output\save-stats.ll.tmp.stats | z:\b\llvm-clang-x86_64-sie-win\build\bin\filecheck.exe Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llc\save-stats.ll
# executed command: 'z:\b\llvm-clang-x86_64-sie-win\build\bin\llc.exe' -mtriple=arm64-apple-macosx --save-stats=obj -o 'Z:\b\llvm-clang-x86_64-sie-win\build\test\tools\llc\Output\save-stats.ll.tmp.s' 'Z:\b\llvm-clang-x86_64-sie-win\llvm-project\llvm\test\tools\llc\save-stats.ll'
# .---command stderr------------
# | z:\b\llvm-clang-x86_64-sie-win\build\bin\llc.exe: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-win running on as-builder-8 while building llvm at step 7 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/54/builds/14490

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\llc.exe -mtriple=arm64-apple-macosx --save-stats=obj -o C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\test\tools\llc\Output\save-stats.ll.tmp.s C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\tools\llc\save-stats.ll && cat C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\test\tools\llc\Output\save-stats.ll.tmp.stats | c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\filecheck.exe C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\tools\llc\save-stats.ll
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\llc.exe' -mtriple=arm64-apple-macosx --save-stats=obj -o 'C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\test\tools\llc\Output\save-stats.ll.tmp.s' 'C:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\llvm-project\llvm\test\tools\llc\save-stats.ll'
# .---command stderr------------
# | c:\buildbot\as-builder-8\llvm-nvptx-nvidia-win\build\bin\llc.exe: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building llvm at step 9 "Add check check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/33777

Here is the relevant piece of the build log for the reference
Step 9 (Add check check-llvm) failure: test (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/test/tools/llc/Output/save-stats.ll.tmp.s /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/tools/llc/save-stats.ll && cat /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/test/tools/llc/Output/save-stats.ll.tmp.stats | /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/FileCheck /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/tools/llc/save-stats.ll
# executed command: /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/test/tools/llc/Output/save-stats.ll.tmp.s /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/test/tools/llc/save-stats.ll
# .---command stderr------------
# | /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.build/bin/llc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


tomershafir added a commit to tomershafir/llvm-project that referenced this pull request Nov 9, 2025
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-win running on as-builder-8 while building llvm at step 7 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/155/builds/14681

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llc.exe -mtriple=arm64-apple-macosx --save-stats=obj -o C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\tools\llc\Output\save-stats.ll.tmp.s C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\tools\llc\save-stats.ll && cat C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\tools\llc\Output\save-stats.ll.tmp.stats | c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\filecheck.exe C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\tools\llc\save-stats.ll
# executed command: 'c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llc.exe' -mtriple=arm64-apple-macosx --save-stats=obj -o 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\test\tools\llc\Output\save-stats.ll.tmp.s' 'C:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\llvm-project\llvm\test\tools\llc\save-stats.ll'
# .---command stderr------------
# | c:\buildbot\as-builder-8\llvm-nvptx64-nvidia-win\build\bin\llc.exe: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-darwin running on doug-worker-3 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/23/builds/15392

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llc/Output/save-stats.ll.tmp.s /Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/llvm/test/tools/llc/save-stats.ll && cat /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llc/Output/save-stats.ll.tmp.stats | /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/FileCheck /Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/llvm/test/tools/llc/save-stats.ll
# executed command: /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/test/tools/llc/Output/save-stats.ll.tmp.s /Volumes/RAMDisk/buildbot-root/x86_64-darwin/llvm-project/llvm/test/tools/llc/save-stats.ll
# .---command stderr------------
# | /Volumes/RAMDisk/buildbot-root/x86_64-darwin/build/bin/llc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder clang-solaris11-sparcv9 running on solaris11-sparcv9 while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/13/builds/10522

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/test/tools/llc/Output/save-stats.ll.tmp.s /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/test/tools/llc/save-stats.ll && cat /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/test/tools/llc/Output/save-stats.ll.tmp.stats | /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/FileCheck /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/test/tools/llc/save-stats.ll
# executed command: /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/test/tools/llc/Output/save-stats.ll.tmp.s /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/test/tools/llc/save-stats.ll
# .---command stderr------------
# | /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/llc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx64-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/27920

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/test/tools/llc/Output/save-stats.ll.tmp.s /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/tools/llc/save-stats.ll && cat /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/test/tools/llc/Output/save-stats.ll.tmp.stats | /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/tools/llc/save-stats.ll
# executed command: /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/test/tools/llc/Output/save-stats.ll.tmp.s /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/llvm-project/llvm/test/tools/llc/save-stats.ll
# .---command stderr------------
# | /home/buildbot/worker/as-builder-7/llvm-nvptx64-nvidia-ubuntu/build/bin/llc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-nvptx-nvidia-ubuntu running on as-builder-7 while building llvm at step 6 "test-build-unified-tree-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/28060

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-llvm) failure: test (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
/home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/test/tools/llc/Output/save-stats.ll.tmp.s /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/tools/llc/save-stats.ll && cat /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/test/tools/llc/Output/save-stats.ll.tmp.stats | /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/FileCheck /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/tools/llc/save-stats.ll
# executed command: /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/llc -mtriple=arm64-apple-macosx --save-stats=obj -o /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/test/tools/llc/Output/save-stats.ll.tmp.s /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/llvm-project/llvm/test/tools/llc/save-stats.ll
# .---command stderr------------
# | /home/buildbot/worker/as-builder-7/llvm-nvptx-nvidia-ubuntu/build/bin/llc: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


tomershafir added a commit that referenced this pull request Nov 9, 2025
A quick fix for the CI failure introduced by
#163967
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Nov 9, 2025
@llvm-ci
Copy link
Collaborator

llvm-ci commented Nov 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-win-x-armv7l running on as-builder-1 while building llvm at step 9 "test-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/38/builds/6256

Here is the relevant piece of the build log for the reference
Step 9 (test-check-llvm) failure: Test just built components: check-llvm completed (failure)
******************** TEST 'LLVM :: tools/llc/save-stats.ll' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
c:\buildbot\as-builder-1\x-armv7l\build\bin\llc.exe -mtriple=arm64-apple-macosx --save-stats=obj -o C:\buildbot\as-builder-1\x-armv7l\build\test\tools\llc\Output\save-stats.ll.tmp.s C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\tools\llc\save-stats.ll && cat C:\buildbot\as-builder-1\x-armv7l\build\test\tools\llc\Output\save-stats.ll.tmp.stats | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\tools\llc\save-stats.ll
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\llc.exe' -mtriple=arm64-apple-macosx --save-stats=obj -o 'C:\buildbot\as-builder-1\x-armv7l\build\test\tools\llc\Output\save-stats.ll.tmp.s' 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\tools\llc\save-stats.ll'
# .---command stderr------------
# | c:\buildbot\as-builder-1\x-armv7l\build\bin\llc.exe: error: unable to get target for 'arm64-apple-macosx', see --version and --triple.
# `-----------------------------
# error: command failed with exit status: 1

--

********************


tomershafir added a commit to tomershafir/llvm-project that referenced this pull request Nov 10, 2025
This patch adds a Clang-compatible --save-stats option to opt, to provide an easy to use way to save LLVM statistics files when working with opt on the middle end.

This is a follow up on the addition to `llc`: llvm#163967

Like on Clang, one can specify --save-stats, --save-stats=cwd, and --save-stats=obj with the same semantics and JSON format. The pre-existing --stats option is not affected.

The implementation extracts the flag and its methods into the common `CodeGen/CommandFlags` as `LLVM_ABI`, using a new registration class to conservatively enable opt-in rather than let all tools take it. Its only needed for llc and opt for now. Then it refactors llc and adds support for opt.
tomershafir added a commit to tomershafir/llvm-project that referenced this pull request Nov 10, 2025
This patch adds a Clang-compatible --save-stats option to opt, to provide an easy to use way to save LLVM statistics files when working with opt on the middle end.

This is a follow up on the addition to `llc`: llvm#163967

Like on Clang, one can specify --save-stats, --save-stats=cwd, and --save-stats=obj with the same semantics and JSON format. The pre-existing --stats option is not affected.

The implementation extracts the flag and its methods into the common `CodeGen/CommandFlags` as `LLVM_ABI`, using a new registration class to conservatively enable opt-in rather than let all tools take it. Its only needed for llc and opt for now. Then it refactors llc and adds support for opt.
tomershafir added a commit to tomershafir/llvm-project that referenced this pull request Nov 11, 2025
This patch adds a Clang-compatible --save-stats option to opt, to provide an easy to use way to save LLVM statistics files when working with opt on the middle end.

This is a follow up on the addition to `llc`: llvm#163967

Like on Clang, one can specify --save-stats, --save-stats=cwd, and --save-stats=obj with the same semantics and JSON format. The pre-existing --stats option is not affected.

The implementation extracts the flag and its methods into the common `CodeGen/CommandFlags` as `LLVM_ABI`, using a new registration class to conservatively enable opt-in rather than let all tools take it. Its only needed for llc and opt for now. Then it refactors llc and adds support for opt.
tomershafir added a commit that referenced this pull request Nov 13, 2025
This patch adds a Clang-compatible --save-stats option to opt, to
provide an easy to use way to save LLVM statistics files when working
with opt on the middle end.

This is a follow up on the addition to `llc`:
#163967

Like on Clang, one can specify --save-stats, --save-stats=cwd, and
--save-stats=obj with the same semantics and JSON format. The
pre-existing --stats option is not affected.

The implementation extracts the flag and its methods into the common
`CodeGen/CommandFlags` as `LLVM_ABI`, using a new registration class to
conservatively enable opt-in rather than let all tools take it. Its only
needed for llc and opt for now. Then it refactors llc and adds support
for opt.
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Nov 13, 2025
This patch adds a Clang-compatible --save-stats option to opt, to
provide an easy to use way to save LLVM statistics files when working
with opt on the middle end.

This is a follow up on the addition to `llc`:
llvm/llvm-project#163967

Like on Clang, one can specify --save-stats, --save-stats=cwd, and
--save-stats=obj with the same semantics and JSON format. The
pre-existing --stats option is not affected.

The implementation extracts the flag and its methods into the common
`CodeGen/CommandFlags` as `LLVM_ABI`, using a new registration class to
conservatively enable opt-in rather than let all tools take it. Its only
needed for llc and opt for now. Then it refactors llc and adds support
for opt.
tomershafir added a commit to swiftlang/llvm-project that referenced this pull request Nov 25, 2025
This patch adds a Clang-compatible `--save-stats` option, to provide an
easy to use way to save LLVM statistics files when working with llc on
the backend.

Like on Clang, one can specify `--save-stats`, `--save-stats=cwd`, and
`--save-stats=obj` with the same semantics and JSON format.

The implementation uses 2 methods `MaybeEnableStats` and
`MaybeSaveStats` called before and after `compileModule` respectively
that externally own the statistics related logic, while `compileModule`
is now required to return the resolved output filename via an output
param.

Note: like on Clang, the pre-existing `--stats` option is not affected.

(chery-pick 96a5289)
tomershafir added a commit to swiftlang/llvm-project that referenced this pull request Nov 25, 2025
A quick fix for the CI failure introduced by
llvm#163967

(cherry-pick b15e220)
tomershafir added a commit to swiftlang/llvm-project that referenced this pull request Nov 25, 2025
This patch adds a Clang-compatible --save-stats option to opt, to
provide an easy to use way to save LLVM statistics files when working
with opt on the middle end.

This is a follow up on the addition to `llc`:
llvm#163967

Like on Clang, one can specify --save-stats, --save-stats=cwd, and
--save-stats=obj with the same semantics and JSON format. The
pre-existing --stats option is not affected.

The implementation extracts the flag and its methods into the common
`CodeGen/CommandFlags` as `LLVM_ABI`, using a new registration class to
conservatively enable opt-in rather than let all tools take it. Its only
needed for llc and opt for now. Then it refactors llc and adds support
for opt.

(cherry-pick 35ffe10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants