Skip to content

Commit

Permalink
[A-A] change A+A -famd-opt to warn as removed
Browse files Browse the repository at this point in the history
Change-Id: Ib40030bf4e0629fca7525c1d5c36dc6531f045d8
  • Loading branch information
ronlieb committed Jun 27, 2024
1 parent e229abb commit 49a8545
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
4 changes: 4 additions & 0 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,10 @@ def warn_drv_global_isel_incomplete_opt : Warning<
"-fglobal-isel support is incomplete for this architecture at the current optimization level">,
InGroup<GlobalISel>;

def warn_drv_amd_opt_removed : Warning<
"[AMD] proprietary optimization compiler has been removed">,
InGroup<UnusedCommandLineArgument>;

def warn_drv_amd_opt_not_found : Warning<
"The [AMD] proprietary optimization compiler installation was not found">,
InGroup<UnusedCommandLineArgument>;
Expand Down
24 changes: 6 additions & 18 deletions clang/lib/Driver/ToolChains/AmdOptArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// Closed optimization compiler is invoked if -famd-opt is specified, or
// if any of the closed optimization flags are specified on the command line.
// These can also include -mllvm options as well as -f<options>
//
// Support is removed for -famd-opt, issue a warning.
//
//===----------------------------------------------------------------------===//

#include "CommonArgs.h"
Expand Down Expand Up @@ -337,29 +340,14 @@ bool tools::checkForAMDProprietaryOptOptions(
const ToolChain &TC, const Driver &D, const ArgList &Args,
ArgStringList &CmdArgs, bool isLLD, bool checkOnly) {

bool ProprietaryToolChainNeeded = false;
std::string AltPath = D.getInstalledDir();
AltPath += "/../alt/bin";
// -famd-opt enables prorietary compiler and lto
if (Args.hasFlag(options::OPT_famd_opt, options::OPT_fno_amd_opt, false)) {
if (!TC.getVFS().exists(AltPath)) {
D.Diag(diag::warn_drv_amd_opt_not_found);
return false;
}
ProprietaryToolChainNeeded = true;
D.Diag(diag::warn_drv_amd_opt_removed);
return false;
}
// disables amd proprietary compiler
if (Args.hasFlag(options::OPT_fno_amd_opt, options::OPT_famd_opt, false)) {
return false;
}

// check for more AOCC options
ProprietaryToolChainNeeded |= checkForPropOpts(
TC, D, Args, CmdArgs, isLLD, checkOnly, TC.getVFS().exists(AltPath));

if (ProprietaryToolChainNeeded && !TC.getVFS().exists(AltPath)) {
D.Diag(diag::warn_drv_amd_opt_not_found);
return false;
}
return ProprietaryToolChainNeeded;
return false;
}
4 changes: 1 addition & 3 deletions clang/test/Driver/A+A.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,4 @@
// CHECK-OMP-OPEN-NOT: "{{.*}}../alt/bin/ld.lld"

// RUN: %clang -famd-opt -O3 -### %s 2>&1 | FileCheck --check-prefix=CHECK-ALT-MISS %s
// CHECK-ALT-MISS: warning: The [AMD] proprietary optimization compiler installation was not found
// RUN: %clang -fveclib=AMDLIBM -O3 -### %s 2>&1 | FileCheck --check-prefix=CHECK-VECLIB %s
// CHECK-VECLIB: warning: The [AMD] proprietary optimization compiler installation was not found
// CHECK-ALT-MISS: warning: [AMD] proprietary optimization compiler has been removed
2 changes: 1 addition & 1 deletion clang/test/Driver/gcc_forward.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Check that we don't try to forward -Xclang or -mlinker-version to GCC.
// PR12920 -- Check also we may not forward W_Group options to GCC.
//
// RUN: %clang -target powerpc-unknown-unknown \
// RUN: not %clang --target=powerpc-unknown-unknown \
// RUN: %s \
// RUN: -Wall -Wdocumentation \
// RUN: -Xclang foo-bar \
Expand Down
1 change: 0 additions & 1 deletion clang/test/Driver/sparc-march.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
// RUN: not %clang -target sparc64 -march=v9 -### -c %s 2>&1 | FileCheck %s
// RUN: not %clang -target sparc -march=v9 -### -c %s 2>&1 | FileCheck %s
// CHECK: error: unsupported option '-march=' for target
// XFAIL: *

0 comments on commit 49a8545

Please sign in to comment.