[llvm-commits] [llvm] r171722 - in /llvm/trunk: lib/Transforms/Vectorize/BBVectorize.cpp test/Transforms/BBVectorize/cycle.ll test/Transforms/BBVectorize/ld1.ll test/Transforms/BBVectorize/loop1.ll test/Transforms/BBVectorize/req-depth.ll test/Transforms/BBVectorize/search-limit.ll test/Transforms/BBVectorize/simple-int.ll test/Transforms/BBVectorize/simple-ldstr.ll test/Transforms/BBVectorize/simple-sel.ll test/Transforms/BBVectorize/simple.ll test/Transforms/BBVectorize/simple3.ll

Hal Finkel hfinkel at anl.gov
Mon Jan 7 07:20:10 PST 2013


----- Original Message -----
> From: "Chandler Carruth" <chandlerc at gmail.com>
> To: llvm-commits at cs.uiuc.edu
> Sent: Monday, January 7, 2013 4:22:37 AM
> Subject: [llvm-commits] [llvm] r171722 - in /llvm/trunk: lib/Transforms/Vectorize/BBVectorize.cpp
> test/Transforms/BBVectorize/cycle.ll test/Transforms/BBVectorize/ld1.ll test/Transforms/BBVectorize/loop1.ll
> test/Transforms/BBVectorize/req-depth.ll test/Transforms/BBVectorize/search-limit.ll
> test/Transforms/BBVectorize/simple-int.ll test/Transforms/BBVectorize/simple-ldstr.ll
> test/Transforms/BBVectorize/simple-sel.ll test/Transforms/BBVectorize/simple.ll
> test/Transforms/BBVectorize/simple3.ll
> 
> Author: chandlerc
> Date: Mon Jan  7 04:22:36 2013
> New Revision: 171722
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=171722&view=rev
> Log:
> Switch BBVectorize to directly depend on having a TTI analysis.
> 
> This could be simplified further, but Hal has a specific feature for
> ignoring TTI, and so I preserved that.
> 
> Also, I needed to use it because a number of tests fail when
> switching
> from a null TTI to the NoTTI nonce implementation. That seems
> suspicious
> to me and so may be something that you need to look into Hal. I
> worked
> it by preserving the old behavior for these tests with the flag that
> ignores all target info.

I apologize, I should have mentioned this earlier. The BBVectorizer has a target-dependent cost model and also a target-independent heuristic. The target-independent heuristic is not the same as the cost model with trivial costs (because the default cost model assigns everything the same cost, this would actually not work very well). I'll need to add a way for BBVectorize to explicitly detect whether it has non-trivial target costs. I'll do that and then clean up the test-case command-line flags.

Thanks again,
Hal

> 
> Modified:
>     llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp
>     llvm/trunk/test/Transforms/BBVectorize/cycle.ll
>     llvm/trunk/test/Transforms/BBVectorize/ld1.ll
>     llvm/trunk/test/Transforms/BBVectorize/loop1.ll
>     llvm/trunk/test/Transforms/BBVectorize/req-depth.ll
>     llvm/trunk/test/Transforms/BBVectorize/search-limit.ll
>     llvm/trunk/test/Transforms/BBVectorize/simple-int.ll
>     llvm/trunk/test/Transforms/BBVectorize/simple-ldstr.ll
>     llvm/trunk/test/Transforms/BBVectorize/simple-sel.ll
>     llvm/trunk/test/Transforms/BBVectorize/simple.ll
>     llvm/trunk/test/Transforms/BBVectorize/simple3.ll
> 
> Modified: llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp (original)
> +++ llvm/trunk/lib/Transforms/Vectorize/BBVectorize.cpp Mon Jan  7
> 04:22:36 2013
> @@ -199,8 +199,7 @@
>        DT = &P->getAnalysis<DominatorTree>();
>        SE = &P->getAnalysis<ScalarEvolution>();
>        TD = P->getAnalysisIfAvailable<DataLayout>();
> -      TTI = IgnoreTargetInfo ? 0 :
> -        P->getAnalysisIfAvailable<TargetTransformInfo>();
> +      TTI = IgnoreTargetInfo ? 0 :
> &P->getAnalysis<TargetTransformInfo>();
>      }
>  
>      typedef std::pair<Value *, Value *> ValuePair;
> @@ -424,8 +423,7 @@
>        DT = &getAnalysis<DominatorTree>();
>        SE = &getAnalysis<ScalarEvolution>();
>        TD = getAnalysisIfAvailable<DataLayout>();
> -      TTI = IgnoreTargetInfo ? 0 :
> -        getAnalysisIfAvailable<TargetTransformInfo>();
> +      TTI = IgnoreTargetInfo ? 0 :
> &getAnalysis<TargetTransformInfo>();
>  
>        return vectorizeBB(BB);
>      }
> @@ -435,6 +433,7 @@
>        AU.addRequired<AliasAnalysis>();
>        AU.addRequired<DominatorTree>();
>        AU.addRequired<ScalarEvolution>();
> +      AU.addRequired<TargetTransformInfo>();
>        AU.addPreserved<AliasAnalysis>();
>        AU.addPreserved<DominatorTree>();
>        AU.addPreserved<ScalarEvolution>();
> @@ -3022,6 +3021,7 @@
>  static const char bb_vectorize_name[] = "Basic-Block Vectorization";
>  INITIALIZE_PASS_BEGIN(BBVectorize, BBV_NAME, bb_vectorize_name,
>  false, false)
>  INITIALIZE_AG_DEPENDENCY(AliasAnalysis)
> +INITIALIZE_AG_DEPENDENCY(TargetTransformInfo)
>  INITIALIZE_PASS_DEPENDENCY(DominatorTree)
>  INITIALIZE_PASS_DEPENDENCY(ScalarEvolution)
>  INITIALIZE_PASS_END(BBVectorize, BBV_NAME, bb_vectorize_name, false,
>  false)
> 
> Modified: llvm/trunk/test/Transforms/BBVectorize/cycle.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/cycle.ll?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/BBVectorize/cycle.ll (original)
> +++ llvm/trunk/test/Transforms/BBVectorize/cycle.ll Mon Jan  7
> 04:22:36 2013
> @@ -1,5 +1,5 @@
>  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"
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -instcombine -gvn -S | FileCheck %s
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s
>  
>  ; This test checks the non-trivial pairing-induced cycle avoidance.
>  Without this cycle avoidance, the algorithm would otherwise
>  ; want to select the pairs:
> 
> Modified: llvm/trunk/test/Transforms/BBVectorize/ld1.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/ld1.ll?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/BBVectorize/ld1.ll (original)
> +++ llvm/trunk/test/Transforms/BBVectorize/ld1.ll Mon Jan  7 04:22:36
> 2013
> @@ -1,5 +1,5 @@
>  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"
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -instcombine -gvn -S | FileCheck %s
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s
>  
>  define double @test1(double* %a, double* %b, double* %c) nounwind
>  uwtable readonly {
>  entry:
> 
> Modified: llvm/trunk/test/Transforms/BBVectorize/loop1.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/loop1.ll?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/BBVectorize/loop1.ll (original)
> +++ llvm/trunk/test/Transforms/BBVectorize/loop1.ll Mon Jan  7
> 04:22:36 2013
> @@ -1,7 +1,7 @@
>  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-unknown-linux-gnu"
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -instcombine -gvn -S -mtriple=unknown | FileCheck %s
> -; RUN: opt < %s -basicaa -loop-unroll -unroll-threshold=45
> -unroll-allow-partial -bb-vectorize -bb-vectorize-req-chain-depth=3
> -instcombine -gvn -S | FileCheck %s -check-prefix=CHECK-UNRL
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s
> +; RUN: opt < %s -basicaa -loop-unroll -unroll-threshold=45
> -unroll-allow-partial -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s
> -check-prefix=CHECK-UNRL
>  ; The second check covers the use of alias analysis (with loop
>  unrolling).
>  
>  define void @test1(double* noalias %out, double* noalias %in1,
>  double* noalias %in2) nounwind uwtable {
> 
> Modified: llvm/trunk/test/Transforms/BBVectorize/req-depth.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/req-depth.ll?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/BBVectorize/req-depth.ll (original)
> +++ llvm/trunk/test/Transforms/BBVectorize/req-depth.ll Mon Jan  7
> 04:22:36 2013
> @@ -1,6 +1,6 @@
>  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"
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth 3 -S |
> FileCheck %s -check-prefix=CHECK-RD3
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth 2 -S |
> FileCheck %s -check-prefix=CHECK-RD2
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth 3
> -bb-vectorize-ignore-target-info -S | FileCheck %s
> -check-prefix=CHECK-RD3
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth 2
> -bb-vectorize-ignore-target-info -S | FileCheck %s
> -check-prefix=CHECK-RD2
>  
>  define double @test1(double %A1, double %A2, double %B1, double %B2)
>  {
>  	%X1 = fsub double %A1, %B1
> 
> Modified: llvm/trunk/test/Transforms/BBVectorize/search-limit.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/search-limit.ll?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/BBVectorize/search-limit.ll (original)
> +++ llvm/trunk/test/Transforms/BBVectorize/search-limit.ll Mon Jan  7
> 04:22:36 2013
> @@ -1,6 +1,6 @@
>  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"
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -instcombine -gvn -S | FileCheck %s
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-search-limit=4 -instcombine -gvn -S | FileCheck %s
> -check-prefix=CHECK-SL4
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-search-limit=4 -bb-vectorize-ignore-target-info
> -instcombine -gvn -S | FileCheck %s -check-prefix=CHECK-SL4
>  
>  define double @test1(double %A1, double %A2, double %B1, double %B2)
>  {
>  ; CHECK: @test1
> 
> Modified: llvm/trunk/test/Transforms/BBVectorize/simple-int.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/simple-int.ll?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/BBVectorize/simple-int.ll (original)
> +++ llvm/trunk/test/Transforms/BBVectorize/simple-int.ll Mon Jan  7
> 04:22:36 2013
> @@ -1,5 +1,5 @@
>  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"
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -instcombine -gvn -S | FileCheck %s
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s
>  
>  declare double @llvm.fma.f64(double, double, double)
>  declare double @llvm.fmuladd.f64(double, double, double)
> 
> Modified: llvm/trunk/test/Transforms/BBVectorize/simple-ldstr.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/simple-ldstr.ll?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/BBVectorize/simple-ldstr.ll (original)
> +++ llvm/trunk/test/Transforms/BBVectorize/simple-ldstr.ll Mon Jan  7
> 04:22:36 2013
> @@ -1,6 +1,6 @@
>  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"
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -instcombine -gvn -S | FileCheck %s
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-aligned-only -instcombine -gvn -S | FileCheck %s
> -check-prefix=CHECK-AO
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-aligned-only -bb-vectorize-ignore-target-info
> -instcombine -gvn -S | FileCheck %s -check-prefix=CHECK-AO
>  
>  ; Simple 3-pair chain with loads and stores
>  define void @test1(double* %a, double* %b, double* %c) nounwind
>  uwtable readonly {
> 
> Modified: llvm/trunk/test/Transforms/BBVectorize/simple-sel.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/simple-sel.ll?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/BBVectorize/simple-sel.ll (original)
> +++ llvm/trunk/test/Transforms/BBVectorize/simple-sel.ll Mon Jan  7
> 04:22:36 2013
> @@ -1,6 +1,6 @@
>  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"
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -instcombine -gvn -S | FileCheck %s
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-no-bools -instcombine -gvn -S | FileCheck %s
> -check-prefix=CHECK-NB
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-no-bools -bb-vectorize-ignore-target-info -instcombine
> -gvn -S | FileCheck %s -check-prefix=CHECK-NB
>  
>  ; Basic depth-3 chain with select
>  define double @test1(double %A1, double %A2, double %B1, double %B2,
>  i1 %C1, i1 %C2) {
> 
> Modified: llvm/trunk/test/Transforms/BBVectorize/simple.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/simple.ll?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/BBVectorize/simple.ll (original)
> +++ llvm/trunk/test/Transforms/BBVectorize/simple.ll Mon Jan  7
> 04:22:36 2013
> @@ -1,5 +1,5 @@
>  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"
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -instcombine -gvn -S | FileCheck %s
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-ignore-target-info -instcombine -gvn -S | FileCheck %s
>  
>  ; Basic depth-3 chain
>  define double @test1(double %A1, double %A2, double %B1, double %B2)
>  {
> 
> Modified: llvm/trunk/test/Transforms/BBVectorize/simple3.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/BBVectorize/simple3.ll?rev=171722&r1=171721&r2=171722&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/BBVectorize/simple3.ll (original)
> +++ llvm/trunk/test/Transforms/BBVectorize/simple3.ll Mon Jan  7
> 04:22:36 2013
> @@ -1,5 +1,5 @@
>  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"
> -; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-vector-bits=192 -instcombine -gvn -S | FileCheck %s
> +; RUN: opt < %s -bb-vectorize -bb-vectorize-req-chain-depth=3
> -bb-vectorize-vector-bits=192 -bb-vectorize-ignore-target-info
> -instcombine -gvn -S | FileCheck %s
>  
>  ; Basic depth-3 chain
>  define double @test1(double %A1, double %A2, double %A3, double %B1,
>  double %B2, double %B3) {
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list