From 841e30ee95c9f96bacbdd99b0e5f9fd5f78421cd Mon Sep 17 00:00:00 2001 From: mikedn Date: Tue, 15 Oct 2019 02:10:23 +0300 Subject: [PATCH] Fix 2 small Statement issues (dotnet/coreclr#27183) 1. Statement data members have "incorrect" order that leads to unnecessary alignment holes 2. LocalAddressVisitor dumps the statement tree twice Commit migrated from https://github.com/dotnet/coreclr/commit/0f71a90f41cfae2a9675bb37150d3a7d4e8b1423 --- src/coreclr/src/jit/gentree.h | 16 ++++++++-------- src/coreclr/src/jit/morph.cpp | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/coreclr/src/jit/gentree.h b/src/coreclr/src/jit/gentree.h index d82e44f..b02b48e 100644 --- a/src/coreclr/src/jit/gentree.h +++ b/src/coreclr/src/jit/gentree.h @@ -5303,14 +5303,14 @@ public: Statement(GenTree* expr, IL_OFFSETX offset DEBUGARG(unsigned stmtID)) : m_rootNode(expr) , m_treeList(nullptr) + , m_next(nullptr) + , m_prev(nullptr) , m_inlineContext(nullptr) , m_ILOffsetX(offset) #ifdef DEBUG , m_lastILOffset(BAD_IL_OFFSET) , m_stmtID(stmtID) #endif - , m_next(nullptr) - , m_prev(nullptr) , m_compilerAdded(false) { } @@ -5432,6 +5432,12 @@ private: // The value is `nullptr` until we have set the sequencing of the nodes. GenTree* m_treeList; + // The statement nodes are doubly-linked. The first statement node in a block points + // to the last node in the block via its `m_prev` link. Note that the last statement node + // does not point to the first: it's `m_next == nullptr`; that is, the list is not fully circular. + Statement* m_next; + Statement* m_prev; + InlineContext* m_inlineContext; // The inline context for this statement. IL_OFFSETX m_ILOffsetX; // The instr offset (if available). @@ -5441,12 +5447,6 @@ private: unsigned m_stmtID; #endif - // The statement nodes are doubly-linked. The first statement node in a block points - // to the last node in the block via its `m_prev` link. Note that the last statement node - // does not point to the first: it's `m_next == nullptr`; that is, the list is not fully circular. - Statement* m_next; - Statement* m_prev; - bool m_compilerAdded; // Was the statement created by optimizer? }; diff --git a/src/coreclr/src/jit/morph.cpp b/src/coreclr/src/jit/morph.cpp index febdaa9..f834b14 100644 --- a/src/coreclr/src/jit/morph.cpp +++ b/src/coreclr/src/jit/morph.cpp @@ -17857,7 +17857,6 @@ public: if (m_stmtModified) { printf("LocalAddressVisitor modified statement:\n"); - m_compiler->gtDispTree(stmt->GetRootNode()); m_compiler->gtDispStmt(stmt); } -- 2.7.4