#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"
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
/// 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