[PATCH] [msan] Run more optimization after MemorySanitizer pass

Evgeniy Stepanov eugenis at google.com
Tue Jan 29 02:41:43 PST 2013


  I've reduced the CL to 6 optimization passes that really make a difference.

Hi kcc, chandlerc,

http://llvm-reviews.chandlerc.com/D189

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D189?vs=460&id=800#toc

Files:
  lib/CodeGen/BackendUtil.cpp

Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -184,6 +184,17 @@
   const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
   PM.add(createMemorySanitizerPass(CGOpts.SanitizeMemoryTrackOrigins,
                                    CGOpts.SanitizerBlacklistFile));
+
+  // Re-run some generic optimizations to simplify code generated by
+  // MemorySanitizer.
+  if (Builder.OptLevel > 0) {
+    PM.add(createEarlyCSEPass());
+    PM.add(createReassociatePass());
+    PM.add(createLICMPass());
+    PM.add(createGVNPass());
+    PM.add(createInstructionCombiningPass());
+    PM.add(createDeadStoreEliminationPass());
+  }
 }
 
 static void addThreadSanitizerPass(const PassManagerBuilder &Builder,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D189.2.patch
Type: text/x-patch
Size: 825 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130129/d5c18774/attachment.bin>


More information about the cfe-commits mailing list