Skip to content

Commit 3de3347

Browse files
nikictru
authored andcommitted
[flang] Disable loop interchange by default (#155279)
Disable loop interchange by default, while keeping the ability to explicitly enable using `-floop-interchange`. This matches Clang. See discussion on #140182. (cherry picked from commit 8849750)
1 parent a5448ad commit 3de3347

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3265,14 +3265,8 @@ void tools::handleVectorizeSLPArgs(const ArgList &Args,
32653265

32663266
void tools::handleInterchangeLoopsArgs(const ArgList &Args,
32673267
ArgStringList &CmdArgs) {
3268-
// FIXME: instead of relying on shouldEnableVectorizerAtOLevel, we may want to
3269-
// implement a separate function to infer loop interchange from opt level.
3270-
// For now, enable loop-interchange at the same opt levels as loop-vectorize.
3271-
bool EnableInterchange = shouldEnableVectorizerAtOLevel(Args, false);
3272-
OptSpecifier InterchangeAliasOption =
3273-
EnableInterchange ? options::OPT_O_Group : options::OPT_floop_interchange;
3274-
if (Args.hasFlag(options::OPT_floop_interchange, InterchangeAliasOption,
3275-
options::OPT_fno_loop_interchange, EnableInterchange))
3268+
if (Args.hasFlag(options::OPT_floop_interchange,
3269+
options::OPT_fno_loop_interchange, false))
32763270
CmdArgs.push_back("-floop-interchange");
32773271
}
32783272

flang/test/Driver/loop-interchange.f90

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
! RUN: %flang -### -S -fno-loop-interchange %s 2>&1 | FileCheck -check-prefix=CHECK-NO-LOOP-INTERCHANGE %s
33
! RUN: %flang -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-LOOP-INTERCHANGE %s
44
! RUN: %flang -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-LOOP-INTERCHANGE %s
5-
! RUN: %flang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-LOOP-INTERCHANGE %s
6-
! RUN: %flang -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-LOOP-INTERCHANGE %s
7-
! RUN: %flang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-LOOP-INTERCHANGE %s
5+
! RUN: %flang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-LOOP-INTERCHANGE %s
6+
! RUN: %flang -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-LOOP-INTERCHANGE %s
7+
! RUN: %flang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-NO-LOOP-INTERCHANGE %s
88
! RUN: %flang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-NO-LOOP-INTERCHANGE %s
99
! CHECK-LOOP-INTERCHANGE: "-floop-interchange"
1010
! CHECK-NO-LOOP-INTERCHANGE-NOT: "-floop-interchange"

0 commit comments

Comments
 (0)