mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
[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
This commit is contained in:
@ -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.
|
||||
|
Reference in New Issue
Block a user