Skip to content

Conversation

hjyamauchi
Copy link

Three changes:

  • Make depscan flags visible.
  • Fix an issue that a depscan reponse file is written in the current directory without a unique id/hash in its path, collides with another for an identical source file and causes a build error.
  • Fix an issue that causes unexpected cas cache misses due to a temp depscan reponse file path (with a unique id/hash) being specified (incorrectly/unnecessarily) specified as the output object file (the -object-file-name flag) when for code view / pdb debug info is emitted.

@hjyamauchi
Copy link
Author

@swift-ci please test llvm

2 similar comments
@hjyamauchi
Copy link
Author

@swift-ci please test llvm

@hjyamauchi
Copy link
Author

@swift-ci please test llvm

@hjyamauchi
Copy link
Author

Existing failures

Unresolved Tests (3):
  Clang :: Index/Store/json-with-module.m
  Clang :: Index/Store/json-with-pch.c
  Clang :: Index/Store/syntax-only.c

********************
Failed Tests (7):
  Clang :: Modules/GH154840.cpp
  LLVM :: Transforms/Coroutines/coro-retcon-frame-old.ll
  LLVM :: Transforms/Coroutines/coro-retcon-once-dynamic-nocleanup.ll
  LLVM :: Transforms/Coroutines/coro-retcon-once-dynamic.ll
  LLVM :: Transforms/Coroutines/coro-retcon-swift-coroFrameAlloc.ll
  LLVM :: Transforms/Coroutines/coro-split-swift_coroFrameAlloc.ll
  LLVM :: Transforms/PhaseOrdering/X86/excessive-unrolling.ll

eg. https://ci.swift.org/job/pr-apple-llvm-project-llvm-linux/1071/consoleText

@hjyamauchi hjyamauchi marked this pull request as ready for review October 6, 2025 16:07
Copy link

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

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

Can you add test case for CL mode?

@hjyamauchi
Copy link
Author

Can you add test case for CL mode?

Done. PTAL

@hjyamauchi
Copy link
Author

@swift-ci please test llvm

Copy link

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

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

Cool LGTM.

Three changes:
- Make depscan flags visible.
- Fix an issue that a depscan reponse file is written in the current
directory without a unique id/hash in its path, collides with another
for an identical source file and causes a build error.
- Fix an issue that causes unexpected cas cache misses due to a temp
depscan reponse file path (with a unique id/hash) being specified
(incorrectly/unnecessarily) specified as the output object file (the
-object-file-name flag) when for code view / pdb debug info is
emitted.
@hjyamauchi
Copy link
Author

@swift-ci please test llvm

@hjyamauchi
Copy link
Author

For some reason, some flags didn't work on macos and the test failed while it passes on Linux.

I found a style of flags that works for macos/Linux/Windows and updated the test.

Please take another look @cachemeifyoucan

******************** TEST 'Clang :: ClangScanDeps/cas-clang-cl.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
rm -rf /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp # RUN: at line 3
+ rm -rf /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp
split-file /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/clang/test/ClangScanDeps/cas-clang-cl.c /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp # RUN: at line 4
+ split-file /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/clang/test/ClangScanDeps/cas-clang-cl.c /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp
/Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/bin/clang --driver-mode=cl -fdepscan=inline -fdepscan-include-tree -Xclang -fcas-path -Xclang /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp/cas -c /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp/test.c -Xclang -Rcompile-job-cache -v 2>&1 | /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/bin/FileCheck /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/clang/test/ClangScanDeps/cas-clang-cl.c -check-prefix=CACHE-MISS # RUN: at line 6
+ /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/bin/clang --driver-mode=cl -fdepscan=inline -fdepscan-include-tree -Xclang -fcas-path -Xclang /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp/cas -c /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp/test.c -Xclang -Rcompile-job-cache -v
+ /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/bin/FileCheck /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/clang/test/ClangScanDeps/cas-clang-cl.c -check-prefix=CACHE-MISS
/Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/clang/test/ClangScanDeps/cas-clang-cl.c:14:16: error: CACHE-MISS: expected string not found in input
// CACHE-MISS: remark: compile job cache miss
               ^
<stdin>:1:1: note: scanning from here
clang version 22.0.0git (https://github.com/swiftlang/llvm-project.git ed2495126d5a1fa479168be9879e60b029539ede)
^
<stdin>:13:55: note: possible intended match here
clang: warning: argument unused during compilation: '-Xclang -Rcompile-job-cache' [-Wunused-command-line-argument]
                                                      ^

Input file: <stdin>
Check file: /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/clang/test/ClangScanDeps/cas-clang-cl.c

-dump-input=help explains the following input dump.

Input was:
<<<<<<
            1: clang version 22.0.0git (https://github.com/swiftlang/llvm-project.git ed2495126d5a1fa479168be9879e60b029539ede) 
check:14'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
            2: Target: x86_64-pc-windows-msvc 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            3: Thread model: posix 
check:14'0     ~~~~~~~~~~~~~~~~~~~~
            4: InstalledDir: /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/bin 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            5: Build config: +assertions 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~
            6: clang: warning: '/Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp/test.c' treated as the '/U' option [-Wslash-u-filename] 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            7: clang: note: use '--' to treat subsequent arguments as filenames 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            8: clang: warning: argument unused during compilation: '-fdepscan=inline' [-Wunused-command-line-argument] 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            9: clang: warning: argument unused during compilation: '-fdepscan-include-tree' [-Wunused-command-line-argument] 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           10: clang: warning: argument unused during compilation: '-Xclang -fcas-path' [-Wunused-command-line-argument] 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           11: clang: warning: argument unused during compilation: '-Xclang /Users/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp/cas' [-Wunused-command-line-argument] 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           12: clang: warning: argument unused during compilation: '/U sers/ec2-user/jenkins/workspace/pr-apple-llvm-project-llvm-macos/branch-next/llvm-project/build/tools/clang/test/ClangScanDeps/Output/cas-clang-cl.c.tmp/test.c' [-Wunused-command-line-argument] 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           13: clang: warning: argument unused during compilation: '-Xclang -Rcompile-job-cache' [-Wunused-command-line-argument] 
check:14'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:14'1                                                           ?                                                             possible intended match
>>>>>>

@cachemeifyoucan
Copy link

LGTM

@hjyamauchi hjyamauchi merged commit f7af125 into swiftlang:next Oct 7, 2025
0 of 2 checks passed
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.

2 participants