r189441 - Revert r189440 - Disable loop vectorizer unrolling when no unrolling requested

Hal Finkel hfinkel at anl.gov
Tue Aug 27 22:21:45 PDT 2013


Author: hfinkel
Date: Wed Aug 28 00:21:45 2013
New Revision: 189441

URL: http://llvm.org/viewvc/llvm-project?rev=189441&view=rev
Log:
Revert r189440 - Disable loop vectorizer unrolling when no unrolling requested

As Chandler pointed out, we should not be using -backend-option because this
will cause crashes for users of the tooling interface, etc. A better way to fix
this will be to provide the unrolling pass-manager flag to the loop vectorizer
directly.

Original commit message:

Disable loop vectorizer unrolling when no unrolling requested

In addition to the regular loop unrolling transformation, the loop vectorizer
can also unroll loops. If no unrolling has specifically been requested (by
-fno-unroll-loops), and the loop vectorizer will be used, then add the backend
option to (also) prevent the loop vectorizer from unrolling loops.

I confirmed with Nadav (off list) that disabling vectorizer loop unrolling when
-fno-unroll-loops is provided is the desired behavior.

Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=189441&r1=189440&r2=189441&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 28 00:21:45 2013
@@ -3382,19 +3382,9 @@ void Clang::ConstructJob(Compilation &C,
   OptSpecifier VectorizeAliasOption = EnableVec ? options::OPT_O_Group :
     options::OPT_fvectorize;
   if (Args.hasFlag(options::OPT_fvectorize, VectorizeAliasOption,
-                   options::OPT_fno_vectorize, EnableVec)) {
+                   options::OPT_fno_vectorize, EnableVec))
     CmdArgs.push_back("-vectorize-loops");
 
-    // In addition to the regular loop unrolling transformation, the loop
-    // vectorizer can also unroll loops. If no unrolling has specifically been
-    // requested, then also prevent the loop vectorizer from unrolling loops.
-    if (Args.hasFlag(options::OPT_fno_unroll_loops,
-        options::OPT_funroll_loops, false)) {
-      CmdArgs.push_back("-backend-option");
-      CmdArgs.push_back("-force-vector-unroll=1");
-    }
-  }
-
   // -fslp-vectorize is default.
   if (Args.hasFlag(options::OPT_fslp_vectorize,
                    options::OPT_fno_slp_vectorize, true))

Modified: cfe/trunk/test/Driver/clang_f_opts.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=189441&r1=189440&r2=189441&view=diff
==============================================================================
--- cfe/trunk/test/Driver/clang_f_opts.c (original)
+++ cfe/trunk/test/Driver/clang_f_opts.c Wed Aug 28 00:21:45 2013
@@ -45,7 +45,6 @@
 // CHECK-NO-UNROLL-LOOPS: "-fno-unroll-loops"
 
 // RUN: %clang -### -S -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
-// RUN: %clang -### -S -fvectorize -fno-unroll-loops %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE-NO-UNROLL %s
 // RUN: %clang -### -S -fno-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
 // RUN: %clang -### -S -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
 // RUN: %clang -### -S -fvectorize -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
@@ -66,8 +65,6 @@
 // RUN: %clang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
 // CHECK-VECTORIZE: "-vectorize-loops"
 // CHECK-NO-VECTORIZE-NOT: "-vectorize-loops"
-// CHECK-VECTORIZE-NOT: "-backend-option" "-force-vector-unroll=1"
-// CHECK-VECTORIZE-NO-UNROLL: "-backend-option" "-force-vector-unroll=1"
 
 // RUN: %clang -### -S -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s
 // RUN: %clang -### -S -fno-slp-vectorize -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s





More information about the cfe-commits mailing list