[PATCH] D35063: [ConstHoisting] Turn on consthoist-with-block-frequency by default

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 6 09:17:08 PDT 2017


wmi created this revision.
Herald added a subscriber: sanjoy.

Using profile information to guide consthoisting is generally helpful for performance, so we want to turn it on by default. No compile time or perf regression were found using spec2000 and spec2006 on x86.  Some significant improvement (>20%) was seen on internal benchmarks.


Repository:
  rL LLVM

https://reviews.llvm.org/D35063

Files:
  lib/Transforms/Scalar/ConstantHoisting.cpp
  test/CodeGen/X86/fold-tied-op.ll
  test/Transforms/ConstantHoisting/X86/ehpad.ll


Index: test/Transforms/ConstantHoisting/X86/ehpad.ll
===================================================================
--- test/Transforms/ConstantHoisting/X86/ehpad.ll
+++ test/Transforms/ConstantHoisting/X86/ehpad.ll
@@ -1,9 +1,6 @@
-; RUN: opt -S -consthoist < %s | FileCheck %s
+; RUN: opt -S -consthoist -consthoist-with-block-frequency=false < %s | FileCheck %s
 ; RUN: opt -S -consthoist -consthoist-with-block-frequency=true < %s | FileCheck --check-prefix=BFIHOIST %s
 
-; FIXME: The catchpad doesn't even use the constant, so a better fix would be to
-; insert the bitcast in the catchpad block.
-
 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-windows-msvc"
 
Index: test/CodeGen/X86/fold-tied-op.ll
===================================================================
--- test/CodeGen/X86/fold-tied-op.ll
+++ test/CodeGen/X86/fold-tied-op.ll
@@ -6,8 +6,8 @@
 target triple = "i386--netbsd"
 
 ; CHECK-LABEL: fn1
-; CHECK:       orl  {{.*#+}} 4-byte Folded Reload
 ; CHECK:       addl {{.*#+}} 4-byte Folded Reload
+; CHECK:       orl  {{.*#+}} 4-byte Folded Reload
 ; CHECK:       xorl {{.*#+}} 4-byte Folded Reload
 ; CHECK:       xorl {{.*#+}} 4-byte Folded Reload
 ; CHECK:       retl
Index: lib/Transforms/Scalar/ConstantHoisting.cpp
===================================================================
--- lib/Transforms/Scalar/ConstantHoisting.cpp
+++ lib/Transforms/Scalar/ConstantHoisting.cpp
@@ -55,7 +55,7 @@
 STATISTIC(NumConstantsRebased, "Number of constants rebased");
 
 static cl::opt<bool> ConstHoistWithBlockFrequency(
-    "consthoist-with-block-frequency", cl::init(false), cl::Hidden,
+    "consthoist-with-block-frequency", cl::init(true), cl::Hidden,
     cl::desc("Enable the use of the block frequency analysis to reduce the "
              "chance to execute const materialization more frequently than "
              "without hoisting."));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35063.105450.patch
Type: text/x-patch
Size: 1921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170706/94dee994/attachment.bin>


More information about the llvm-commits mailing list