[PATCH] [msan] Run more optimization after MemorySanitizer pass
Evgeniy Stepanov
eugenis at google.com
Wed Jan 30 06:38:48 PST 2013
Here, the best I can say without writing a page-long essay with examples. Sorry, it's not much.
MSan instrumentation is driven by the original code. We essentially take every incoming instruction and emit another instruction (or ten) next to it, operating on the shadow values (but sometimes on the real values, too). Two programs in one, essentially. There can be any kinds of redundancies in the second one, so we just run whatever is normally run at -O2, and then exclude some passes that do not help much with benchmarks.
Hi kcc, chandlerc,
http://llvm-reviews.chandlerc.com/D189
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D189?vs=800&id=830#toc
Files:
lib/CodeGen/BackendUtil.cpp
Index: lib/CodeGen/BackendUtil.cpp
===================================================================
--- lib/CodeGen/BackendUtil.cpp
+++ lib/CodeGen/BackendUtil.cpp
@@ -184,6 +184,18 @@
const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts();
PM.add(createMemorySanitizerPass(CGOpts.SanitizeMemoryTrackOrigins,
CGOpts.SanitizerBlacklistFile));
+
+ // MemorySanitizer inserts complex instrumentation that mostly follows
+ // the logic of the original code, but operates on "shadow" values.
+ // It can benefit from re-running some general purpose optimization passes.
+ 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.3.patch
Type: text/x-patch
Size: 956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130130/acffe123/attachment.bin>
More information about the cfe-commits
mailing list