[polly] r202010 - Dead code elimination: Schedule another approximative step before actual DCE

Tobias Grosser tobias at grosser.es
Mon Feb 24 00:52:20 PST 2014


Author: grosser
Date: Mon Feb 24 02:52:20 2014
New Revision: 202010

URL: http://llvm.org/viewvc/llvm-project?rev=202010&view=rev
Log:
Dead code elimination: Schedule another approximative step before actual DCE

In 'obsequi' we have a scop in which the current dead code elimination works,
but the generated code is way too complex. To avoid this trouble (and to not
disable the DCE entirely) we add an additional approximative step before
the actual dead code elimination. This should fix one of the two current
nightly-test issues.

Polly could be improved to handle 'obsequi' by teaching it to introduce only a
single parameter for (%1 and zext %1) which halves the number of parameters and
allows polly to derive a simpler representation for the set of live iterations.
However, this needs some time to investigate.

I will commit a test case as soon as we have a reduced one.

Modified:
    polly/trunk/lib/DeadCodeElimination.cpp
    polly/trunk/test/DeadCodeElimination/dead_iteration_elimination.ll

Modified: polly/trunk/lib/DeadCodeElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/DeadCodeElimination.cpp?rev=202010&r1=202009&r2=202010&view=diff
==============================================================================
--- polly/trunk/lib/DeadCodeElimination.cpp (original)
+++ polly/trunk/lib/DeadCodeElimination.cpp Mon Feb 24 02:52:20 2014
@@ -47,9 +47,10 @@ namespace {
 
 cl::opt<int> DCEPreciseSteps(
     "polly-dce-precise-steps",
-    cl::desc(
-        "The number of precise steps between two approximating iterations"),
-    cl::init(2));
+    cl::desc("The number of precise steps between two approximating "
+             "iterations. (A value of -1 schedules another approximation stage "
+             "before the actual dead code elimination."),
+    cl::init(-1));
 
 class DeadCodeElim : public ScopPass {
 
@@ -103,6 +104,9 @@ bool DeadCodeElim::eliminateDeadCode(Sco
   isl_union_map *Dep = D->getDependences(Dependences::TYPE_RAW);
   Dep = isl_union_map_reverse(Dep);
 
+  if (PreciseSteps == -1)
+    Live = isl_union_set_affine_hull(Live);
+
   isl_union_set *OriginalDomain = S.getDomains();
   int Steps = 0;
   while (true) {

Modified: polly/trunk/test/DeadCodeElimination/dead_iteration_elimination.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/DeadCodeElimination/dead_iteration_elimination.ll?rev=202010&r1=202009&r2=202010&view=diff
==============================================================================
--- polly/trunk/test/DeadCodeElimination/dead_iteration_elimination.ll (original)
+++ polly/trunk/test/DeadCodeElimination/dead_iteration_elimination.ll Mon Feb 24 02:52:20 2014
@@ -1,4 +1,4 @@
-; RUN: opt -S %loadPolly -basicaa -polly-dependences-analysis-type=value-based -polly-dce -polly-ast -analyze < %s | FileCheck %s -check-prefix=CHECK
+; RUN: opt -S %loadPolly -basicaa -polly-dependences-analysis-type=value-based -polly-dce -polly-dce-precise-steps=2 -polly-ast -analyze < %s | FileCheck %s -check-prefix=CHECK
 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"
 target triple = "x86_64-pc-linux-gnu"
 ;





More information about the llvm-commits mailing list