Skip to content

Commit a793a03

Browse files
authored
Revert "[SYCL][Driver] Propagate floating point optimizations flag (#2680)" (#2707)
This reverts commit ce08889. Reason: the issue with this implementation is that we can't preserve correct correlation between the option and the source impacted by this option. `-ffast-math` is applied to C++ translation unit, whereas single SPIR-V module might include code sections from multiple translation units and some of them might be compiled with `-fno-fast-math`.
1 parent 6e232d5 commit a793a03

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -511,19 +511,6 @@ static void addImpliedArgs(const llvm::Triple &Triple,
511511
BeArgs.push_back("-g");
512512
if (Args.getLastArg(options::OPT_O0))
513513
BeArgs.push_back("-cl-opt-disable");
514-
// Check if floating pointing optimizations are allowed.
515-
bool isFastMath = isOptimizationLevelFast(Args);
516-
Arg *A = Args.getLastArg(options::OPT_ffast_math, options::OPT_fno_fast_math,
517-
options::OPT_funsafe_math_optimizations,
518-
options::OPT_fno_unsafe_math_optimizations);
519-
isFastMath =
520-
isFastMath || (A && (A->getOption().getID() == options::OPT_ffast_math ||
521-
A->getOption().getID() ==
522-
options::OPT_funsafe_math_optimizations));
523-
A = Args.getLastArg(options::OPT_ffp_model_EQ);
524-
isFastMath = isFastMath || (A && StringRef(A->getValue()).equals("fast"));
525-
if (isFastMath)
526-
BeArgs.push_back("-cl-fast-relaxed-math");
527514
if (BeArgs.empty())
528515
return;
529516
if (Triple.getSubArch() == llvm::Triple::NoSubArch ||

clang/test/Driver/sycl-offload.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -904,13 +904,5 @@
904904
// CHECK-STD-OVR: clang{{.*}} "-emit-obj" {{.*}} "-std=c++14"
905905
// CHECK-STD-OVR-NOT: clang{{.*}} "-std=c++17"
906906

907-
// Bypass -cl-fast-relaxed-math to SPIR-V compiler.
908-
// RUN: %clang -### -fsycl -fsycl-targets=spir64-unknown-unknown-sycldevice -ffast-math %s 2>&1 | FileCheck -check-prefix=CHECK-FAST-MATH-OPT %s
909-
// RUN: %clang -### -fsycl -fsycl-targets=spir64-unknown-unknown-sycldevice -funsafe-math-optimizations %s 2>&1 | FileCheck -check-prefix=CHECK-FAST-MATH-OPT %s
910-
// RUN: %clang -### -fsycl -fsycl-targets=spir64-unknown-unknown-sycldevice -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK-FAST-MATH-OPT %s
911-
// RUN: %clang -### -fsycl -fsycl-targets=spir64-unknown-unknown-sycldevice -ffp-model=fast %s 2>&1 | FileCheck -check-prefix=CHECK-FAST-MATH-OPT %s
912-
// RUN: %clang_cl -### -fsycl -fsycl-targets=spir64-unknown-unknown-sycldevice /fp:fast %s 2>&1 | FileCheck -check-prefix=CHECK-FAST-MATH-OPT %s
913-
// CHECK-FAST-MATH-OPT: clang-offload-wrapper{{.*}} "-compile-opts=-cl-fast-relaxed-math"
914-
915907
// TODO: SYCL specific fail - analyze and enable
916908
// XFAIL: windows-msvc

0 commit comments

Comments
 (0)