[PATCH] D11234: Add debug option to turn off zero cost phi node inserting in PRE

Lawrence Hu lawrence at codeaurora.org
Wed Jul 15 11:43:39 PDT 2015


hulx2000 created this revision.
hulx2000 added reviewers: dberlin, apazos, zinob, mcrosier.
hulx2000 added a subscriber: llvm-commits.
hulx2000 set the repository for this revision to rL LLVM.

commit 403050abcc091260be2e8f58484e7a39c0782b47
Author: Daniel Berlin <dberlin at dberlin.org>
Date:   Tue Feb 3 20:37:08 2015 +0000

    Allow PRE to insert no-cost phi nodes

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228024 91177308-0d34-0410-b5e6-96231b3b80d8

Have very broad performance impact to our benchmark, the degradation are up to 30%.

According to owner of this patch, there is no easy fix for now, so I created this patch to add a debug option to allow us to turn this feature off with this debug option, the debug option is off by default.


Repository:
  rL LLVM

http://reviews.llvm.org/D11234

Files:
  lib/Transforms/Scalar/GVN.cpp

Index: lib/Transforms/Scalar/GVN.cpp
===================================================================
--- lib/Transforms/Scalar/GVN.cpp
+++ lib/Transforms/Scalar/GVN.cpp
@@ -67,6 +67,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> DisableZeroCostPHIPRE("disable-phi-pre", cl::init(false));
 
 // Maximum allowed recursion depth.
 static cl::opt<uint32_t>
@@ -2529,7 +2530,8 @@
 
   // Don't do PRE when it might increase code size, i.e. when
   // we would need to insert instructions in more than one pred.
-  if (NumWithout > 1 || NumWith == 0)
+  if ((DisableZeroCostPHIPRE && NumWithout != 1) || 
+      ((!DisableZeroCostPHIPRE) && NumWithout > 1) || NumWith == 0)
     return false;
 
   // We may have a case where all predecessors have the instruction,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11234.29806.patch
Type: text/x-patch
Size: 922 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150715/6f5b033c/attachment.bin>


More information about the llvm-commits mailing list