[llvm] r261578 - [LoopDataPrefetch] Make it testable with opt
Adam Nemet via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 22 13:41:23 PST 2016
Author: anemet
Date: Mon Feb 22 15:41:22 2016
New Revision: 261578
URL: http://llvm.org/viewvc/llvm-project?rev=261578&view=rev
Log:
[LoopDataPrefetch] Make it testable with opt
Summary:
Since this is an IR pass it's nice to be able to write tests without
llc. This is the counterpart of the llc test under
CodeGen/PowerPC/loop-data-prefetch.ll.
Reviewers: hfinkel
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D17464
Added:
llvm/trunk/test/Transforms/LoopDataPrefetch/
llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/
llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/basic.ll
llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/lit.local.cfg
Modified:
llvm/trunk/include/llvm/InitializePasses.h
llvm/trunk/lib/Transforms/Scalar/Scalar.cpp
Modified: llvm/trunk/include/llvm/InitializePasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/InitializePasses.h?rev=261578&r1=261577&r2=261578&view=diff
==============================================================================
--- llvm/trunk/include/llvm/InitializePasses.h (original)
+++ llvm/trunk/include/llvm/InitializePasses.h Mon Feb 22 15:41:22 2016
@@ -163,6 +163,7 @@ void initializeLiveStacksPass(PassRegist
void initializeLiveVariablesPass(PassRegistry&);
void initializeLoaderPassPass(PassRegistry&);
void initializeLocalStackSlotPassPass(PassRegistry&);
+void initializeLoopDataPrefetchPass(PassRegistry&);
void initializeLoopPassPass(PassRegistry&);
void initializeLoopDeletionPass(PassRegistry&);
void initializeLoopExtractorPass(PassRegistry&);
Modified: llvm/trunk/lib/Transforms/Scalar/Scalar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Scalar.cpp?rev=261578&r1=261577&r2=261578&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/Scalar.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/Scalar.cpp Mon Feb 22 15:41:22 2016
@@ -47,6 +47,7 @@ void llvm::initializeScalarOpts(PassRegi
initializeIndVarSimplifyPass(Registry);
initializeJumpThreadingPass(Registry);
initializeLICMPass(Registry);
+ initializeLoopDataPrefetchPass(Registry);
initializeLoopDeletionPass(Registry);
initializeLoopAccessAnalysisPass(Registry);
initializeLoopInstSimplifyPass(Registry);
Added: llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/basic.ll?rev=261578&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/basic.ll (added)
+++ llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/basic.ll Mon Feb 22 15:41:22 2016
@@ -0,0 +1,25 @@
+; RUN: opt -mcpu=a2 -loop-data-prefetch -S < %s | FileCheck %s
+target datalayout = "E-m:e-i64:64-n32:64"
+target triple = "powerpc64-bgq-linux"
+
+define void @foo(double* nocapture %a, double* nocapture readonly %b) {
+entry:
+ br label %for.body
+
+; CHECK: for.body:
+for.body: ; preds = %for.body, %entry
+ %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body ]
+ %arrayidx = getelementptr inbounds double, double* %b, i64 %indvars.iv
+; CHECK: call void @llvm.prefetch
+ %0 = load double, double* %arrayidx, align 8
+ %add = fadd double %0, 1.000000e+00
+ %arrayidx2 = getelementptr inbounds double, double* %a, i64 %indvars.iv
+ store double %add, double* %arrayidx2, align 8
+ %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
+ %exitcond = icmp eq i64 %indvars.iv.next, 1600
+ br i1 %exitcond, label %for.end, label %for.body
+
+; CHECK: for.end:
+for.end: ; preds = %for.body
+ ret void
+}
Added: llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/lit.local.cfg?rev=261578&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/lit.local.cfg (added)
+++ llvm/trunk/test/Transforms/LoopDataPrefetch/PowerPC/lit.local.cfg Mon Feb 22 15:41:22 2016
@@ -0,0 +1,2 @@
+if not 'PowerPC' in config.root.targets:
+ config.unsupported = True
More information about the llvm-commits
mailing list