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 | 3333e668221f52f8c708df0037ee9c4bf2417929 (patch) | |
tree | 351f84edeaea8dfca4fc850669752b0dfbfec687 /lib/Transforms/Instrumentation/MemorySanitizer.cpp | |
parent | 042a9a2666690d0170964df3d0b042b7bc4651d5 (diff) | |
download | llvm-3333e668221f52f8c708df0037ee9c4bf2417929.tar.gz llvm-3333e668221f52f8c708df0037ee9c4bf2417929.tar.bz2 llvm-3333e668221f52f8c708df0037ee9c4bf2417929.tar.xz |
[msan] Remove unreachable blocks before instrumenting a function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170883 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Instrumentation/MemorySanitizer.cpp')
-rw-r--r-- | lib/Transforms/Instrumentation/MemorySanitizer.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 6407740065..c151c3bd0f 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/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. |