summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-07-24 23:57:25 +0000
committerDan Gohman <gohman@apple.com>2008-07-24 23:57:25 +0000
commit5f36a32e7bf5f7fb05579c5f73f678c55429d1be (patch)
tree4c99147e16cc406e2ebdc50c11920aa2a11d68c2 /llvm/lib/Transforms
parenta23b9f0e90273920bff188979420df90fb98d202 (diff)
downloadbcm5719-llvm-5f36a32e7bf5f7fb05579c5f73f678c55429d1be.tar.gz
bcm5719-llvm-5f36a32e7bf5f7fb05579c5f73f678c55429d1be.zip
Put the LICM of constant GlobalVariables, introduced in r53945, under a
command-line option, and disable it by default. It introduced performance regressions because CodeGen is currently not able to remat such loads. llvm-svn: 53997
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/LICM.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 13440c13b65..aef1cd6f6f8 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -62,6 +62,15 @@ 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 VISIBILITY_HIDDEN LICM : public LoopPass {
static char ID; // Pass identification, replacement for typeid
@@ -372,7 +381,8 @@ 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 (AA->pointsToConstantMemory(LI->getOperand(0)))
+ if (EnableLICMConstantMotion &&
+ AA->pointsToConstantMemory(LI->getOperand(0)))
return true;
// Don't hoist loads which have may-aliased stores in loop.
OpenPOWER on IntegriCloud