[NewPassManager] Add tuning option: SLPVectorization [clang-change]
Summary: NewPassManager is not using CodeGenOpts values before this patch. [to be coupled with D61616] Reviewers: chandlerc Subscribers: jlebar, cfe-commits, llvm-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61617 llvm-svn: 361534
This commit is contained in:
parent
3249be1e03
commit
267ac925fb
|
@ -1050,7 +1050,14 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
|
||||||
CodeGenOpts.DebugInfoForProfiling);
|
CodeGenOpts.DebugInfoForProfiling);
|
||||||
}
|
}
|
||||||
|
|
||||||
PassBuilder PB(TM.get(), PipelineTuningOptions(), PGOOpt);
|
PipelineTuningOptions PTO;
|
||||||
|
// For historical reasons, loop interleaving is set to mirror setting for loop
|
||||||
|
// unrolling.
|
||||||
|
PTO.LoopInterleaving = CodeGenOpts.UnrollLoops;
|
||||||
|
PTO.LoopVectorization = CodeGenOpts.VectorizeLoop;
|
||||||
|
PTO.SLPVectorization = CodeGenOpts.VectorizeSLP;
|
||||||
|
|
||||||
|
PassBuilder PB(TM.get(), PTO, PGOOpt);
|
||||||
|
|
||||||
// Attempt to load pass plugins and register their callbacks with PB.
|
// Attempt to load pass plugins and register their callbacks with PB.
|
||||||
for (auto &PluginFN : CodeGenOpts.PassPlugins) {
|
for (auto &PluginFN : CodeGenOpts.PassPlugins) {
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
// RUN: %clang -target x86_64 -S -c -O1 -fvectorize -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-ENABLE-VECT
|
||||||
|
// RUN: %clang -target x86_64 -S -c -O1 -fno-vectorize -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-DISABLE-VECT
|
||||||
|
// RUN: %clang -target x86_64 -fexperimental-new-pass-manager -S -c -O1 -fvectorize -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-ENABLE-VECT
|
||||||
|
// RUN: %clang -target x86_64 -fexperimental-new-pass-manager -S -c -O1 -fno-vectorize -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-DISABLE-VECT
|
||||||
|
|
||||||
|
// CHECK-ENABLE-VECT-LABEL: @for_test()
|
||||||
|
// CHECK-ENABLE-VECT: fmul <{{[0-9]+}} x double>
|
||||||
|
|
||||||
|
// CHECK-DISABLE-VECT-LABEL: @for_test()
|
||||||
|
// CHECK-DISABLE-VECT: fmul double
|
||||||
|
// CHECK-DISABLE-VECT-NOT: fmul <{{[0-9]+}} x double>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void for_test() {
|
||||||
|
double A[1000], B[1000];
|
||||||
|
int L = 500;
|
||||||
|
for (int i = 0; i < L; i++) {
|
||||||
|
A[i] = i;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < L; i++) {
|
||||||
|
B[i] = A[i]*5;
|
||||||
|
}
|
||||||
|
printf("%lf %lf\n", A[0], B[0]);
|
||||||
|
}
|
Loading…
Reference in New Issue