[llvm] r242842 - [MDA] change BlockScanLimit into a command line option.

Jingyue Wu jingyue at google.com
Tue Jul 21 14:50:40 PDT 2015


Author: jingyue
Date: Tue Jul 21 16:50:39 2015
New Revision: 242842

URL: http://llvm.org/viewvc/llvm-project?rev=242842&view=rev
Log:
[MDA] change BlockScanLimit into a command line option.

Summary:
In the benchmark (https://github.com/vetter/shoc) we are researching,
the duplicated load is not eliminated because MemoryDependenceAnalysis
hit the BlockScanLimit. This patch change it into a command line option
instead of a hardcoded value.

Patched by Xuetian Weng. 

Test Plan: test/Analysis/MemoryDependenceAnalysis/memdep-block-scan-limit.ll

Reviewers: jingyue, reames

Subscribers: reames, llvm-commits

Differential Revision: http://reviews.llvm.org/D11366

Added:
    llvm/trunk/test/Analysis/MemoryDependenceAnalysis/memdep-block-scan-limit.ll
Modified:
    llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=242842&r1=242841&r2=242842&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Tue Jul 21 16:50:39 2015
@@ -49,7 +49,11 @@ STATISTIC(NumCacheCompleteNonLocalPtr,
           "Number of block queries that were completely cached");
 
 // Limit for the number of instructions to scan in a block.
-static const unsigned int BlockScanLimit = 100;
+
+static cl::opt<unsigned> BlockScanLimit(
+    "memdep-block-scan-limit", cl::Hidden, cl::init(100),
+    cl::desc("The number of instructions to scan in a block in memory "
+             "dependency analysis (default = 100)"));
 
 // Limit on the number of memdep results to process.
 static const unsigned int NumResultsLimit = 100;

Added: llvm/trunk/test/Analysis/MemoryDependenceAnalysis/memdep-block-scan-limit.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/MemoryDependenceAnalysis/memdep-block-scan-limit.ll?rev=242842&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/MemoryDependenceAnalysis/memdep-block-scan-limit.ll (added)
+++ llvm/trunk/test/Analysis/MemoryDependenceAnalysis/memdep-block-scan-limit.ll Tue Jul 21 16:50:39 2015
@@ -0,0 +1,15 @@
+; RUN: opt -S -memdep -gvn -basicaa < %s | FileCheck %s
+; RUN: opt -S -memdep -memdep-block-scan-limit=1 -gvn -basicaa < %s | FileCheck %s --check-prefix=WITH-LIMIT
+; CHECK-LABEL: @test(
+; CHECK: load
+; CHECK-NOT: load
+; WITH-LIMIT-LABEL: @test(
+; WITH-LIMIT-CHECK: load
+; WITH-LIMIT-CHECK: load
+define i32 @test(i32* %p) {
+ %1 = load i32, i32* %p
+ %2 = add i32 %1, 3
+ %3 = load i32, i32* %p
+ %4 = add i32 %2, %3
+ ret i32 %4
+}





More information about the llvm-commits mailing list