summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Instrumentation
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-12-21 11:18:49 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2012-12-21 11:18:49 +0000
commit4fbc0d08bfe929f2d968e2120908c98eeb974072 (patch)
treeb5b805a03cafa21d4df79abfb3659dca817c3dbb /llvm/lib/Transforms/Instrumentation
parenta5b57100d444ea9791201039b1abc28a3f264873 (diff)
downloadbcm5719-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.cpp8
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.
OpenPOWER on IntegriCloud