@@ -5757,27 +5757,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
5757
5757
CmdArgs.push_back("-Wno-sycl-strict");
5758
5758
}
5759
5759
5760
- // If no optimization controlling flags (-O) are provided, check if
5761
- // any debug information flags(-g) are passed.
5762
- // "-fintelfpga" implies "-g" and we preserve the default optimization for
5763
- // this flow(-O2).
5764
- // if "-g" is explicitly passed from the command-line, set default
5765
- // optimization to -O0.
5766
-
5767
- if (!Args.hasArgNoClaim(options::OPT_O_Group, options::OPT__SLASH_O)) {
5768
- StringRef OptLevel = "-O2";
5769
- const Arg *DebugInfoGroup = Args.getLastArg(options::OPT_g_Group);
5770
- // -fintelfpga -g case
5771
- if ((Args.hasArg(options::OPT_fintelfpga) &&
5772
- Args.hasMultipleArgs(options::OPT_g_Group)) ||
5773
- /* -fsycl -g case */ (!Args.hasArg(options::OPT_fintelfpga) &&
5774
- DebugInfoGroup)) {
5775
- if (!DebugInfoGroup->getOption().matches(options::OPT_g0)) {
5776
- OptLevel = "-O0";
5777
- }
5778
- }
5779
- CmdArgs.push_back(OptLevel.data());
5780
- }
5760
+ // Set O2 optimization level by default
5761
+ if (!Args.getLastArg(options::OPT_O_Group))
5762
+ CmdArgs.push_back("-O2");
5781
5763
5782
5764
// Add the integration header option to generate the header.
5783
5765
StringRef Header(D.getIntegrationHeader(Input.getBaseInput()));
@@ -11083,25 +11065,7 @@ static std::string getSYCLPostLinkOptimizationLevel(const ArgList &Args) {
11083
11065
[=](char c) { return c == S[0]; }))
11084
11066
return std::string("-O") + S[0];
11085
11067
}
11086
- // If no optimization controlling flags (-O) are provided, check if
11087
- // any debug information flags(-g) are passed.
11088
- // "-fintelfpga" implies "-g" and we preserve the default optimization for
11089
- // this flow(-O2).
11090
- // if "-g" is explicitly passed from the command-line, set default
11091
- // optimization to -O0.
11092
-
11093
- if (!Args.hasArg(options::OPT_O_Group)) {
11094
- const Arg *DebugInfoGroup = Args.getLastArg(options::OPT_g_Group);
11095
- // -fintelfpga -g case
11096
- if ((Args.hasArg(options::OPT_fintelfpga) &&
11097
- Args.hasMultipleArgs(options::OPT_g_Group)) ||
11098
- /* -fsycl -g case */
11099
- (!Args.hasArg(options::OPT_fintelfpga) && DebugInfoGroup)) {
11100
- if (!DebugInfoGroup->getOption().matches(options::OPT_g0)) {
11101
- return "-O0";
11102
- }
11103
- }
11104
- }
11068
+
11105
11069
// The default for SYCL device code optimization
11106
11070
return "-O2";
11107
11071
}
0 commit comments