[llvm-commits] [llvm] r48720 - /llvm/trunk/lib/Transforms/Scalar/GVN.cpp

Evan Cheng evan.cheng at apple.com
Sun Mar 23 22:28:39 PDT 2008


Author: evancheng
Date: Mon Mar 24 00:28:38 2008
New Revision: 48720

URL: http://llvm.org/viewvc/llvm-project?rev=48720&view=rev
Log:
Temporarily disabling memset forming optimization. Add an option.

Modified:
    llvm/trunk/lib/Transforms/Scalar/GVN.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/GVN.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVN.cpp?rev=48720&r1=48719&r2=48720&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVN.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVN.cpp Mon Mar 24 00:28:38 2008
@@ -32,6 +32,7 @@
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/MemoryDependenceAnalysis.h"
 #include "llvm/Support/CFG.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/GetElementPtrTypeIterator.h"
 #include "llvm/Target/TargetData.h"
@@ -41,6 +42,12 @@
 STATISTIC(NumGVNLoad, "Number of loads deleted");
 STATISTIC(NumMemSetInfer, "Number of memsets inferred");
 
+namespace {
+  cl::opt<bool>
+  FormMemSet("form-memset-from-stores",
+             cl::desc("Transform straight-line stores to memsets"),
+             cl::init(false), cl::Hidden);
+}
 
 //===----------------------------------------------------------------------===//
 //                         ValueTable Class
@@ -1102,6 +1109,7 @@
 /// neighboring locations of memory.  If it sees enough consequtive ones
 /// (currently 4) it attempts to merge them together into a memcpy/memset.
 bool GVN::processStore(StoreInst *SI, SmallVectorImpl<Instruction*> &toErase) {
+  if (!FormMemSet) return false;
   if (SI->isVolatile()) return false;
   
   // There are two cases that are interesting for this code to handle: memcpy





More information about the llvm-commits mailing list