[PATCH] D31827: Add a flag that enables more aggressive load PRE

Taewook Oh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 11:06:23 PDT 2017


twoh created this revision.

Existing load PRE implementation is very conservative about code size increase and performs PRE only when there's no instruction count increase. This patch adds an option to allow more aggressive load PRE.


https://reviews.llvm.org/D31827

Files:
  lib/Transforms/Scalar/GVN.cpp


Index: lib/Transforms/Scalar/GVN.cpp
===================================================================
--- lib/Transforms/Scalar/GVN.cpp
+++ lib/Transforms/Scalar/GVN.cpp
@@ -71,6 +71,7 @@
 static cl::opt<bool> EnablePRE("enable-pre",
                                cl::init(true), cl::Hidden);
 static cl::opt<bool> EnableLoadPRE("enable-load-pre", cl::init(true));
+static cl::opt<bool> AggressiveLoadPRE("aggressive-load-pre", cl::init(false));
 
 // Maximum allowed recursion depth.
 static cl::opt<uint32_t>
@@ -1083,7 +1084,7 @@
   // FIXME: If we could restructure the CFG, we could make a common pred with
   // all the preds that don't have an available LI and insert a new load into
   // that one block.
-  if (NumUnavailablePreds != 1)
+  if (!AggressiveLoadPRE && NumUnavailablePreds != 1)
       return false;
 
   // Split critical edges, and update the unavailable predecessors accordingly.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31827.94560.patch
Type: text/x-patch
Size: 910 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170410/0a001c9f/attachment.bin>


More information about the llvm-commits mailing list