Fix asan failure introduced by cl/210618122 and statement walker crash for if statements without else clause.
PiperOrigin-RevId: 211186361
diff --git a/lib/IR/Statement.cpp b/lib/IR/Statement.cpp
index 673aa43..2a5a2d7 100644
--- a/lib/IR/Statement.cpp
+++ b/lib/IR/Statement.cpp
@@ -366,9 +366,10 @@
}
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.
}