From 2d29d98df06e9397d9870785968b7e321ab2968b Mon Sep 17 00:00:00 2001 From: Tatiana Shpeisman Date: Sun, 2 Sep 2018 08:48:54 -0700 Subject: [PATCH] Fix the underlying cause for the asan test failure introduced by cl/210618122. Restored the order of deleting then-clause before else-clause in if-statement destructor, since it does not and should not matter. PiperOrigin-RevId: 211273720 --- mlir/include/mlir/IR/UseDefLists.h | 1 + mlir/lib/IR/Statement.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/mlir/include/mlir/IR/UseDefLists.h b/mlir/include/mlir/IR/UseDefLists.h index e7cb9f1f2e60..3489eb1e8496 100644 --- a/mlir/include/mlir/IR/UseDefLists.h +++ b/mlir/include/mlir/IR/UseDefLists.h @@ -108,6 +108,7 @@ public: other.removeFromCurrent(); value = other.value; other.value = nullptr; + other.back = nullptr; nextUse = nullptr; back = nullptr; insertIntoCurrent(); diff --git a/mlir/lib/IR/Statement.cpp b/mlir/lib/IR/Statement.cpp index 2a5a2d789468..65ca3403aa87 100644 --- a/mlir/lib/IR/Statement.cpp +++ b/mlir/lib/IR/Statement.cpp @@ -366,10 +366,11 @@ IfStmt::IfStmt(Location *location, unsigned numOperands, IntegerSet *set) } IfStmt::~IfStmt() { + delete thenClause; + if (elseClause) delete elseClause; - delete thenClause; // An IfStmt's IntegerSet 'set' should not be deleted since it is // allocated through MLIRContext's bump pointer allocator. }