[PATCH] D23028: GVN-hoist: limit the length of dependent instructions

Sebastian Pop via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 14:02:30 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL277651: GVN-hoist: limit the length of dependent instructions (authored by spop).

Changed prior to commit:
  https://reviews.llvm.org/D23028?vs=66355&id=66711#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D23028

Files:
  llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp

Index: llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
+++ llvm/trunk/lib/Transforms/Scalar/GVNHoist.cpp
@@ -53,6 +53,11 @@
     cl::desc("Hoist instructions from the beginning of the BB up to the "
              "maximum specified depth (default = 100, unlimited = -1)"));
 
+static cl::opt<int> MaxChainLength(
+    "gvn-hoist-max-chain-length", cl::Hidden, cl::init(10),
+    cl::desc("Maximum length of dependent chains to hoist "
+             "(default = 10, unlimited = -1)"));
+
 namespace {
 
 // Provides a sorting function based on the execution order of two instructions.
@@ -212,8 +217,13 @@
         DFSNumber[&Inst] = ++I;
     }
 
+    int ChainLength = 0;
+
     // FIXME: use lazy evaluation of VN to avoid the fix-point computation.
     while (1) {
+      if (MaxChainLength != -1 && ++ChainLength >= MaxChainLength)
+        return Res;
+
       auto HoistStat = hoistExpressions(F);
       if (HoistStat.first + HoistStat.second == 0)
         return Res;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23028.66711.patch
Type: text/x-patch
Size: 1094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160803/be882aba/attachment.bin>


More information about the llvm-commits mailing list