diff options
| author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-12-21 11:18:49 +0000 |
|---|---|---|
| committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-12-21 11:18:49 +0000 |
| commit | 4fbc0d08bfe929f2d968e2120908c98eeb974072 (patch) | |
| tree | b5b805a03cafa21d4df79abfb3659dca817c3dbb /llvm/lib/Transforms/Instrumentation | |
| parent | a5b57100d444ea9791201039b1abc28a3f264873 (diff) | |
| download | bcm5719-llvm-4fbc0d08bfe929f2d968e2120908c98eeb974072.tar.gz bcm5719-llvm-4fbc0d08bfe929f2d968e2120908c98eeb974072.zip | |
[msan] Remove unreachable blocks before instrumenting a function.
llvm-svn: 170883
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 6407740065a..c151c3bd0f2 100644 --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -67,6 +67,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" +#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/ModuleUtils.h" #include "llvm/Type.h" @@ -485,6 +486,13 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> { bool runOnFunction() { MS.initializeCallbacks(*F.getParent()); if (!MS.TD) return false; + + // In the presence of unreachable blocks, we may see Phi nodes with + // incoming nodes from such blocks. Since InstVisitor skips unreachable + // blocks, such nodes will not have any shadow value associated with them. + // It's easier to remove unreachable blocks than deal with missing shadow. + removeUnreachableBlocks(F); + // Iterate all BBs in depth-first order and create shadow instructions // for all instructions (where applicable). // For PHI nodes we create dummy shadow PHIs which will be finalized later. |

