diff options
| author | Uday Bondhugula <bondhugula@google.com> | 2018-12-30 12:51:17 -0800 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 14:47:58 -0700 |
| commit | 545f3ce430886c651bfbe3f099c6a5dae9cf5e51 (patch) | |
| tree | 0db505299fbc0de69d2cc3219d1fad8e82fbc0df /mlir/lib/Transforms/MemRefDataFlowOpt.cpp | |
| parent | dfee0a6e9b0c4f0e3bb5f8335b4808e221b3ef6c (diff) | |
| download | bcm5719-llvm-545f3ce430886c651bfbe3f099c6a5dae9cf5e51.tar.gz bcm5719-llvm-545f3ce430886c651bfbe3f099c6a5dae9cf5e51.zip | |
Fix ASAN failure in memref-dataflow-opt
- memrefsToErase had duplicates inserted into it; switch to SmallPtrSet.
PiperOrigin-RevId: 227299306
Diffstat (limited to 'mlir/lib/Transforms/MemRefDataFlowOpt.cpp')
| -rw-r--r-- | mlir/lib/Transforms/MemRefDataFlowOpt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp index d1af131d383..bad1cf9d101 100644 --- a/mlir/lib/Transforms/MemRefDataFlowOpt.cpp +++ b/mlir/lib/Transforms/MemRefDataFlowOpt.cpp @@ -28,7 +28,7 @@ #include "mlir/Pass.h" #include "mlir/StandardOps/StandardOps.h" #include "mlir/Transforms/Passes.h" -#include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/SmallPtrSet.h" #include <algorithm> #define DEBUG_TYPE "memref-dataflow-opt" @@ -72,7 +72,7 @@ struct MemRefDataFlowOpt : public FunctionPass, InstWalker<MemRefDataFlowOpt> { void visitOperationInst(OperationInst *opInst); // A list of memref's that are potentially dead / could be eliminated. - std::vector<Value *> memrefsToErase; + SmallPtrSet<Value *, 4> memrefsToErase; static char passID; }; @@ -199,7 +199,7 @@ void MemRefDataFlowOpt::visitOperationInst(OperationInst *opInst) { Value *storeVal = lastWriteStoreOp->cast<StoreOp>()->getValueToStore(); loadOp->getResult()->replaceAllUsesWith(storeVal); // Record the memref for a later sweep to optimize away. - memrefsToErase.push_back(loadOp->getMemRef()); + memrefsToErase.insert(loadOp->getMemRef()); loadOp->erase(); } |

