summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Tremoulet <jotrem@microsoft.com>2017-03-20 15:39:46 -0400
committerJoseph Tremoulet <jotrem@microsoft.com>2017-03-20 15:41:49 -0400
commitffe7ea09fc7cb027cf832520090974de09947881 (patch)
treed41b1402c6e1651d6713881d9128abb9b80de8c8
parent149a455cb6c46d793cc5be33d34142c118564086 (diff)
downloadcoreclr-ffe7ea09fc7cb027cf832520090974de09947881.tar.gz
coreclr-ffe7ea09fc7cb027cf832520090974de09947881.tar.bz2
coreclr-ffe7ea09fc7cb027cf832520090974de09947881.zip
Permit null object in `GenTreeUseEdgeIterator`
We use `GT_FIELD` for static field loads, which have no instance pointer. Update the iterator constructor to recognize this as a valid state rather than fail an assertion.
-rw-r--r--src/jit/gentree.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index f0b2e41a54..243f6cf40e 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -9322,9 +9322,15 @@ GenTreeUseEdgeIterator::GenTreeUseEdgeIterator(GenTree* node)
return;
case GT_FIELD:
- m_edge = &m_node->AsField()->gtFldObj;
- assert(*m_edge != nullptr);
- m_advance = &GenTreeUseEdgeIterator::Terminate;
+ if (m_node->AsField()->gtFldObj == nullptr)
+ {
+ m_state = -1;
+ }
+ else
+ {
+ m_edge = &m_node->AsField()->gtFldObj;
+ m_advance = &GenTreeUseEdgeIterator::Terminate;
+ }
return;
case GT_STMT: