From: Chad Rosier Date: Mon, 28 Apr 2014 19:30:57 +0000 (+0000) Subject: [driver] Disable the slp vectorizer at -O0, -O1, and -Oz. This mirrors the X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf6a66cd290403bd051f6e4266c96786e666993e;p=clang [driver] Disable the slp vectorizer at -O0, -O1, and -Oz. This mirrors the behavior of the loop vectorizer, which is enabled at -O2, -O3, -O4, -Ofast and -Os. PR19568 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207433 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 991fe4358e..a8d3f010bd 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -3912,9 +3912,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_fno_vectorize, EnableVec)) CmdArgs.push_back("-vectorize-loops"); - // -fslp-vectorize is default. - if (Args.hasFlag(options::OPT_fslp_vectorize, - options::OPT_fno_slp_vectorize, true)) + // -fslp-vectorize is enabled based on the optimization level selected. + OptSpecifier SLPVectAliasOption = EnableVec ? options::OPT_O_Group : + options::OPT_fslp_vectorize; + if (Args.hasFlag(options::OPT_fslp_vectorize, SLPVectAliasOption, + options::OPT_fno_slp_vectorize, EnableVec)) CmdArgs.push_back("-vectorize-slp"); // -fno-slp-vectorize-aggressive is default. diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c index 63eaf41d5b..6e4fa72cb5 100644 --- a/test/Driver/clang_f_opts.c +++ b/test/Driver/clang_f_opts.c @@ -89,6 +89,17 @@ // RUN: %clang -### -S -fno-tree-slp-vectorize -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s // RUN: %clang -### -S -fno-tree-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s // RUN: %clang -### -S -ftree-slp-vectorize -fno-slp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s +// RUN: %clang -### -S -O %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s +// RUN: %clang -### -S -O2 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s +// RUN: %clang -### -S -Os %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s +// RUN: %clang -### -S -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s +// RUN: %clang -### -S -fno-slp-vectorize -O3 %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s +// RUN: %clang -### -S -O1 -fslp-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s +// RUN: %clang -### -S -Ofast %s 2>&1 | FileCheck -check-prefix=CHECK-SLP-VECTORIZE %s +// RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s +// RUN: %clang -### -S -O0 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s +// RUN: %clang -### -S -O1 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s +// RUN: %clang -### -S -Oz %s 2>&1 | FileCheck -check-prefix=CHECK-NO-SLP-VECTORIZE %s // CHECK-SLP-VECTORIZE: "-vectorize-slp" // CHECK-NO-SLP-VECTORIZE-NOT: "-vectorize-slp"