From ac2cea83feefcf86fdf50f43821f544e8e521968 Mon Sep 17 00:00:00 2001 From: Sergey Andreenko Date: Fri, 2 Mar 2018 12:41:13 -0800 Subject: [PATCH] [RyuJit] fix clang switch warning (#16693) * fix clang switch warning * Try to set throw blocks only for nodes that generates exceptions themselves. Update comments. --- src/jit/stacklevelsetter.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/jit/stacklevelsetter.cpp b/src/jit/stacklevelsetter.cpp index 0694bfd..97296fc 100644 --- a/src/jit/stacklevelsetter.cpp +++ b/src/jit/stacklevelsetter.cpp @@ -91,8 +91,7 @@ void StackLevelSetter::ProcessBlock(BasicBlock* block) // Set throw blocks incoming stack depth for x86. if (throwHelperBlocksUsed && !framePointerRequired) { - bool operMightThrow = ((node->gtFlags & GTF_EXCEPT) != 0); - if (operMightThrow) + if (node->OperMayThrow(comp)) { SetThrowHelperBlocks(node, block); } @@ -119,13 +118,16 @@ void StackLevelSetter::ProcessBlock(BasicBlock* block) // from the node. // // Notes: -// one node can target several helper blocks. +// one node can target several helper blocks, but not all operands that throw do this. +// So the function can set 0-2 throw blocks depends on oper and overflow flag. // // Arguments: // node - the node to process; // block - the source block for the node. void StackLevelSetter::SetThrowHelperBlocks(GenTree* node, BasicBlock* block) { + assert(node->OperMayThrow(comp)); + // Check that it uses throw block, find its kind, find the block, set level. switch (node->OperGet()) { @@ -154,6 +156,8 @@ void StackLevelSetter::SetThrowHelperBlocks(GenTree* node, BasicBlock* block) SetThrowHelperBlock(SCK_ARITH_EXCPN, block); } break; + default: // Other opers can target throw only due to overflow. + break; } if (node->gtOverflowEx()) { -- 2.7.4