This revision was automatically updated to reflect the committed changes. Closed by commit rG6f79f80e6e47: [HIP] Fix duplicate clang -cc1 options on MSVC toolchain (authored by yaxunl). Herald added a project: clang.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D76032/new/ https://reviews.llvm.org/D76032 Files: clang/lib/Driver/ToolChains/MSVC.cpp clang/test/Driver/hip-options.hip Index: clang/test/Driver/hip-options.hip =================================================================== --- clang/test/Driver/hip-options.hip +++ clang/test/Driver/hip-options.hip @@ -8,3 +8,8 @@ // // CHECK: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device" // CHECK-SAME: "--gpu-max-threads-per-block=1024" + +// RUN: %clang -### -x hip -target x86_64-pc-windows-msvc -fms-extensions \ +// RUN: -mllvm -amdgpu-early-inline-all=true %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MLLVM %s +// MLLVM-NOT: "-mllvm"{{.*}}"-amdgpu-early-inline-all=true"{{.*}}"-mllvm"{{.*}}"-amdgpu-early-inline-all=true" Index: clang/lib/Driver/ToolChains/MSVC.cpp =================================================================== --- clang/lib/Driver/ToolChains/MSVC.cpp +++ clang/lib/Driver/ToolChains/MSVC.cpp @@ -1483,7 +1483,8 @@ llvm::opt::DerivedArgList * MSVCToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args, - StringRef BoundArch, Action::OffloadKind) const { + StringRef BoundArch, + Action::OffloadKind OFK) const { DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs()); const OptTable &Opts = getDriver().getOpts(); @@ -1522,7 +1523,8 @@ } else if (A->getOption().matches(options::OPT_D)) { // Translate -Dfoo#bar into -Dfoo=bar. TranslateDArg(A, *DAL, Opts); - } else { + } else if (OFK != Action::OFK_HIP) { + // HIP Toolchain translates input args by itself. DAL->append(A); } }
Index: clang/test/Driver/hip-options.hip =================================================================== --- clang/test/Driver/hip-options.hip +++ clang/test/Driver/hip-options.hip @@ -8,3 +8,8 @@ // // CHECK: clang{{.*}}" "-cc1" {{.*}} "-fcuda-is-device" // CHECK-SAME: "--gpu-max-threads-per-block=1024" + +// RUN: %clang -### -x hip -target x86_64-pc-windows-msvc -fms-extensions \ +// RUN: -mllvm -amdgpu-early-inline-all=true %s 2>&1 | \ +// RUN: FileCheck -check-prefix=MLLVM %s +// MLLVM-NOT: "-mllvm"{{.*}}"-amdgpu-early-inline-all=true"{{.*}}"-mllvm"{{.*}}"-amdgpu-early-inline-all=true" Index: clang/lib/Driver/ToolChains/MSVC.cpp =================================================================== --- clang/lib/Driver/ToolChains/MSVC.cpp +++ clang/lib/Driver/ToolChains/MSVC.cpp @@ -1483,7 +1483,8 @@ llvm::opt::DerivedArgList * MSVCToolChain::TranslateArgs(const llvm::opt::DerivedArgList &Args, - StringRef BoundArch, Action::OffloadKind) const { + StringRef BoundArch, + Action::OffloadKind OFK) const { DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs()); const OptTable &Opts = getDriver().getOpts(); @@ -1522,7 +1523,8 @@ } else if (A->getOption().matches(options::OPT_D)) { // Translate -Dfoo#bar into -Dfoo=bar. TranslateDArg(A, *DAL, Opts); - } else { + } else if (OFK != Action::OFK_HIP) { + // HIP Toolchain translates input args by itself. DAL->append(A); } }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits