Skip to content

Commit cedceeb

Browse files
authored
Revert "Introduce -fexperimental-loop-fuse to clang and flang (#142686)" (#158764)
This reverts commit 895cda7. And fix attempt: 06f671e. Performance regressions and broken sanitizers, see #142686.
1 parent 71c1282 commit cedceeb

File tree

15 files changed

+1
-64
lines changed

15 files changed

+1
-64
lines changed

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@ CODEGENOPT(TimeTrace , 1, 0, Benign) ///< Set when -ftime-trace is enabl
322322
VALUE_CODEGENOPT(TimeTraceGranularity, 32, 500, Benign) ///< Minimum time granularity (in microseconds),
323323
///< traced by time profiler
324324
CODEGENOPT(InterchangeLoops , 1, 0, Benign) ///< Run loop-interchange.
325-
CODEGENOPT(FuseLoops , 1, 0, Benign) ///< Run loop-fusion.
326325
CODEGENOPT(UnrollLoops , 1, 0, Benign) ///< Control whether loops are unrolled.
327326
CODEGENOPT(RerollLoops , 1, 0, Benign) ///< Control whether loops are rerolled.
328327
CODEGENOPT(NoUseJumpTables , 1, 0, Benign) ///< Set when -fno-jump-tables is enabled.

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4304,10 +4304,6 @@ def floop_interchange : Flag<["-"], "floop-interchange">, Group<f_Group>,
43044304
HelpText<"Enable the loop interchange pass">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>;
43054305
def fno_loop_interchange: Flag<["-"], "fno-loop-interchange">, Group<f_Group>,
43064306
HelpText<"Disable the loop interchange pass">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>;
4307-
defm experimental_loop_fusion
4308-
: OptInCC1FFlag<"experimental-loop-fusion", "Enable", "Disable",
4309-
"Enable the loop fusion pass",
4310-
[ClangOption, FlangOption, FC1Option]>;
43114307
def funroll_loops : Flag<["-"], "funroll-loops">, Group<f_Group>,
43124308
HelpText<"Turn on loop unroller">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>;
43134309
def fno_unroll_loops : Flag<["-"], "fno-unroll-loops">, Group<f_Group>,

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
896896
PipelineTuningOptions PTO;
897897
PTO.LoopUnrolling = CodeGenOpts.UnrollLoops;
898898
PTO.LoopInterchange = CodeGenOpts.InterchangeLoops;
899-
PTO.LoopFusion = CodeGenOpts.FuseLoops;
900899
// For historical reasons, loop interleaving is set to mirror setting for loop
901900
// unrolling.
902901
PTO.LoopInterleaving = CodeGenOpts.UnrollLoops;
@@ -1332,7 +1331,6 @@ runThinLTOBackend(CompilerInstance &CI, ModuleSummaryIndex *CombinedIndex,
13321331
Conf.SampleProfile = std::move(SampleProfile);
13331332
Conf.PTO.LoopUnrolling = CGOpts.UnrollLoops;
13341333
Conf.PTO.LoopInterchange = CGOpts.InterchangeLoops;
1335-
Conf.PTO.LoopFusion = CGOpts.FuseLoops;
13361334
// For historical reasons, loop interleaving is set to mirror setting for loop
13371335
// unrolling.
13381336
Conf.PTO.LoopInterleaving = CGOpts.UnrollLoops;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6861,8 +6861,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
68616861
options::OPT_fno_unroll_loops);
68626862
Args.AddLastArg(CmdArgs, options::OPT_floop_interchange,
68636863
options::OPT_fno_loop_interchange);
6864-
Args.addOptInFlag(CmdArgs, options::OPT_fexperimental_loop_fusion,
6865-
options::OPT_fno_experimental_loop_fusion);
68666864

68676865
Args.AddLastArg(CmdArgs, options::OPT_fstrict_flex_arrays_EQ);
68686866

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ void Flang::addCodegenOptions(const ArgList &Args,
156156
!stackArrays->getOption().matches(options::OPT_fno_stack_arrays))
157157
CmdArgs.push_back("-fstack-arrays");
158158

159-
Args.addOptInFlag(CmdArgs, options::OPT_fexperimental_loop_fusion,
160-
options::OPT_fno_experimental_loop_fusion);
161-
162159
handleInterchangeLoopsArgs(Args, CmdArgs);
163160
handleVectorizeLoopsArgs(Args, CmdArgs);
164161
handleVectorizeSLPArgs(Args, CmdArgs);

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,9 +1680,6 @@ void CompilerInvocationBase::GenerateCodeGenArgs(const CodeGenOptions &Opts,
16801680
else
16811681
GenerateArg(Consumer, OPT_fno_loop_interchange);
16821682

1683-
if (Opts.FuseLoops)
1684-
GenerateArg(Consumer, OPT_fexperimental_loop_fusion);
1685-
16861683
if (!Opts.BinutilsVersion.empty())
16871684
GenerateArg(Consumer, OPT_fbinutils_version_EQ, Opts.BinutilsVersion);
16881685

@@ -2004,8 +2001,6 @@ bool CompilerInvocation::ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
20042001
(Opts.OptimizationLevel > 1));
20052002
Opts.InterchangeLoops =
20062003
Args.hasFlag(OPT_floop_interchange, OPT_fno_loop_interchange, false);
2007-
Opts.FuseLoops = Args.hasFlag(OPT_fexperimental_loop_fusion,
2008-
OPT_fno_experimental_loop_fusion, false);
20092004
Opts.BinutilsVersion =
20102005
std::string(Args.getLastArgValue(OPT_fbinutils_version_EQ));
20112006

clang/test/Driver/clang_f_opts.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,6 @@
5252
// CHECK-INTERCHANGE-LOOPS: "-floop-interchange"
5353
// CHECK-NO-INTERCHANGE-LOOPS: "-fno-loop-interchange"
5454

55-
// RUN: %clang -### -S -fexperimental-loop-fusion %s 2>&1 | FileCheck -check-prefix=CHECK-FUSE-LOOPS %s
56-
// CHECK-FUSE-LOOPS: "-fexperimental-loop-fusion"
57-
//
58-
// RUN: %clang -c -fexperimental-loop-fusion -mllvm -print-pipeline-passes -O3 %s -o /dev/null 2>&1 | FileCheck --check-prefixes=LOOP-FUSION-ON %s
59-
// RUN: %clang -c -mllvm -print-pipeline-passes -O3 %s -o /dev/null 2>&1 | FileCheck --check-prefixes=LOOP-FUSION-OFF %s
60-
61-
// LOOP-FUSION-ON: loop-fusion
62-
// LOOP-FUSION-OFF-NOT: loop-fusion
63-
6455
// RUN: %clang -### -S -fprofile-sample-accurate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-SAMPLE-ACCURATE %s
6556
// CHECK-PROFILE-SAMPLE-ACCURATE: "-fprofile-sample-accurate"
6657

flang/docs/ReleaseNotes.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ page](https://llvm.org/releases/).
3535

3636
## New Compiler Flags
3737

38-
* -fexperimental-loop-fusion is now recognized by flang.
39-
4038
## Windows Support
4139

4240
## Fortran Language Changes in Flang

flang/include/flang/Frontend/CodeGenOptions.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ CODEGENOPT(StackArrays, 1, 0) ///< -fstack-arrays (enable the stack-arrays pass)
4343
CODEGENOPT(VectorizeLoop, 1, 0) ///< Enable loop vectorization.
4444
CODEGENOPT(VectorizeSLP, 1, 0) ///< Enable SLP vectorization.
4545
CODEGENOPT(InterchangeLoops, 1, 0) ///< Enable loop interchange.
46-
CODEGENOPT(FuseLoops, 1, 0) ///< Enable loop fusion.
4746
CODEGENOPT(LoopVersioning, 1, 0) ///< Enable loop versioning.
4847
CODEGENOPT(UnrollLoops, 1, 0) ///< Enable loop unrolling
4948
CODEGENOPT(AliasAnalysis, 1, 0) ///< Enable alias analysis pass

flang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,6 @@ static void parseCodeGenArgs(Fortran::frontend::CodeGenOptions &opts,
280280
if (args.getLastArg(clang::driver::options::OPT_floop_interchange))
281281
opts.InterchangeLoops = 1;
282282

283-
if (args.getLastArg(clang::driver::options::OPT_fexperimental_loop_fusion))
284-
opts.FuseLoops = 1;
285-
286283
if (args.getLastArg(clang::driver::options::OPT_vectorize_loops))
287284
opts.VectorizeLoop = 1;
288285

0 commit comments

Comments
 (0)