From: Alina Sbirlea Date: Tue, 30 Apr 2019 21:29:20 +0000 (+0000) Subject: [PassManagerBuilder] Add option for interleaved loops, for loop vectorize. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1e33097313abf2f970d621a4c8216d6d3abee377;p=llvm [PassManagerBuilder] Add option for interleaved loops, for loop vectorize. Summary: Match NewPassManager behavior: add option for interleaved loops in the old pass manager, and use that instead of the flag used to disable loop unroll. No changes in the defaults. Reviewers: chandlerc Subscribers: mehdi_amini, jlebar, dmgreen, hsaito, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D61030 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359615 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Transforms/IPO/PassManagerBuilder.h b/include/llvm/Transforms/IPO/PassManagerBuilder.h index ec707e8d866..33648e0f083 100644 --- a/include/llvm/Transforms/IPO/PassManagerBuilder.h +++ b/include/llvm/Transforms/IPO/PassManagerBuilder.h @@ -145,6 +145,7 @@ public: bool DisableUnrollLoops; bool SLPVectorize; bool LoopVectorize; + bool LoopsInterleaved; bool RerollLoops; bool NewGVN; bool DisableGVNLoadPRE; diff --git a/lib/Transforms/IPO/PassManagerBuilder.cpp b/lib/Transforms/IPO/PassManagerBuilder.cpp index eeb196866ea..e8b4b8fe75b 100644 --- a/lib/Transforms/IPO/PassManagerBuilder.cpp +++ b/lib/Transforms/IPO/PassManagerBuilder.cpp @@ -162,9 +162,7 @@ PassManagerBuilder::PassManagerBuilder() { DisableUnrollLoops = false; SLPVectorize = RunSLPVectorization; LoopVectorize = EnableLoopVectorization; - // FIXME: Add: LoopsInterleaved = EnableLoopInterleaving; - // Replace usage of DisableUnrollLoops with LoopsInterleaved when creating - // the LoopVectorize pass, to be consistent with the new pass manager. + LoopsInterleaved = EnableLoopInterleaving; RerollLoops = RunLoopRerolling; NewGVN = RunNewGVN; LicmMssaOptCap = SetLicmMssaOptCap; @@ -673,7 +671,7 @@ void PassManagerBuilder::populateModulePassManager( // llvm.loop.distribute=true or when -enable-loop-distribute is specified. MPM.add(createLoopDistributePass()); - MPM.add(createLoopVectorizePass(DisableUnrollLoops, !LoopVectorize)); + MPM.add(createLoopVectorizePass(!LoopsInterleaved, !LoopVectorize)); // Eliminate loads by forwarding stores from the previous iteration to loads // of the current iteration. diff --git a/test/Transforms/LoopVectorize/X86/unroll-pm.ll b/test/Transforms/LoopVectorize/X86/unroll-pm.ll index 52914b6a7c6..fc1c1540177 100644 --- a/test/Transforms/LoopVectorize/X86/unroll-pm.ll +++ b/test/Transforms/LoopVectorize/X86/unroll-pm.ll @@ -1,5 +1,5 @@ ; RUN: opt < %s -O2 -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx -force-vector-width=4 -S | FileCheck %s -; RUN: opt < %s -O2 -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx -force-vector-width=4 -disable-loop-unrolling -S | FileCheck %s -check-prefix=CHECK-NOUNRL +; RUN: opt < %s -O2 -mtriple=x86_64-apple-macosx10.8.0 -mcpu=corei7-avx -force-vector-width=4 -disable-loop-unrolling -interleave-loops=false -S | FileCheck %s -check-prefix=CHECK-NOUNRL target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.8.0"