Skip to content

Commit be4ea80

Browse files
committed
[HIP] Claim --offloading-compress for -M
Cmake automatically generate dependency files with all compilation options provided by users. When users use for HIP compilation, it causes warnings when cmake generates dependency files. Claim this option to supress warnings.
1 parent 842785a commit be4ea80

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,12 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
10261026
CmdArgs.push_back("-dependency-file");
10271027
CmdArgs.push_back(DepFile);
10281028
}
1029+
// Cmake generates dependency files using all compilation options specified
1030+
// by users. Claim those not used for dependency files.
1031+
if (JA.isOffloading(Action::OFK_HIP)) {
1032+
Args.ClaimAllArgs(options::OPT_offload_compress);
1033+
Args.ClaimAllArgs(options::OPT_no_offload_compress);
1034+
}
10291035

10301036
bool HasTarget = false;
10311037
for (const Arg *A : Args.filtered(options::OPT_MT, options::OPT_MQ)) {

clang/test/Driver/hip-options.hip

+4
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,7 @@
242242
// NO-WARN-ATOMIC: clang{{.*}} "-triple" "amdgcn-amd-amdhsa" {{.*}} "-Werror=atomic-alignment" {{.*}} "-Wno-error=atomic-alignment"
243243
// NO-WARN-ATOMIC-NOT: clang{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-Werror=atomic-alignment"
244244
// NO-WARN-ATOMIC-NOT: clang{{.*}} "-triple" "x86_64-unknown-linux-gnu" {{.*}} "-Wno-error=atomic-alignment"
245+
246+
// Check --offload-compress does not cause warning.
247+
// RUN: %clang -### -Werror --target=x86_64-unknown-linux-gnu -nogpuinc -nogpulib \
248+
// RUN: --offload-arch=gfx1100 --offload-compress --offload-host-only -M %s

0 commit comments

Comments
 (0)