Enable hoisting of loads from constant memory by default. In cases where
authorDan Gohman <gohman@apple.com>
Thu, 19 Nov 2009 19:00:10 +0000 (19:00 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 19 Nov 2009 19:00:10 +0000 (19:00 +0000)
they are lowered to instruction sequences more complex than a simple
load, such that CodeGen cannot rematerialize them, a reload from a
spill slot is likely to be cheaper than the complex sequence.

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

lib/Transforms/Scalar/LICM.cpp
test/Transforms/LICM/2008-07-22-LoadGlobalConstant.ll

index 104c8739c0e36c8d332215e6a2fbb22e92f4592d..a71b3e31e2634b0c9886235ac7dac1422b625386 100644 (file)
@@ -63,15 +63,6 @@ static cl::opt<bool>
 DisablePromotion("disable-licm-promotion", cl::Hidden,
                  cl::desc("Disable memory promotion in LICM pass"));
 
-// This feature is currently disabled by default because CodeGen is not yet
-// capable of rematerializing these constants in PIC mode, so it can lead to
-// degraded performance. Compile test/CodeGen/X86/remat-constant.ll with
-// -relocation-model=pic to see an example of this.
-static cl::opt<bool>
-EnableLICMConstantMotion("enable-licm-constant-variables", cl::Hidden,
-                         cl::desc("Enable hoisting/sinking of constant "
-                                  "global variables"));
-
 namespace {
   struct LICM : public LoopPass {
     static char ID; // Pass identification, replacement for typeid
@@ -383,8 +374,7 @@ bool LICM::canSinkOrHoistInst(Instruction &I) {
 
     // Loads from constant memory are always safe to move, even if they end up
     // in the same alias set as something that ends up being modified.
-    if (EnableLICMConstantMotion &&
-        AA->pointsToConstantMemory(LI->getOperand(0)))
+    if (AA->pointsToConstantMemory(LI->getOperand(0)))
       return true;
     
     // Don't hoist loads which have may-aliased stores in loop.
index 723440f101e55dea61e4e286a7cd105f23073dc1..10b00bab8fd9aa896bedc3b4f7ae6e14e412a9c0 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: opt < %s -licm -enable-licm-constant-variables -S | FileCheck %s
+; RUN: opt < %s -licm -S | FileCheck %s
 
 @a = external constant float*