Skip to content

Commit 7e0e42b

Browse files
authored
[HIP] Claim --offload-compress for -M (llvm#133456) (llvm#3442)
2 parents 60f9156 + 9c796bd commit 7e0e42b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,12 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA,
10581058
CmdArgs.push_back("-dependency-file");
10591059
CmdArgs.push_back(DepFile);
10601060
}
1061+
// Cmake generates dependency files using all compilation options specified
1062+
// by users. Claim those not used for dependency files.
1063+
if (JA.isOffloading(Action::OFK_HIP)) {
1064+
Args.ClaimAllArgs(options::OPT_offload_compress);
1065+
Args.ClaimAllArgs(options::OPT_no_offload_compress);
1066+
}
10611067

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

clang/test/Driver/hip-options.hip

Lines changed: 4 additions & 0 deletions
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)