Improve const return block placement
authorJoseph Tremoulet <jotrem@microsoft.com>
Mon, 11 Sep 2017 18:56:16 +0000 (14:56 -0400)
committerJoseph Tremoulet <jotrem@microsoft.com>
Tue, 12 Sep 2017 01:43:23 +0000 (21:43 -0400)
commit5deb018677a5e62ad7f2e8183604b3461fa144d7
treec9d8e2116d25e275a482ab1d7966472b49a43b28
parent6f898ff7f9702fcad2ac42aa49e76b5e595220b1
Improve const return block placement

Tweak a few things so that generated constant return blocks get laid out
more optimally:

 - Don't set BBF_DONT_REMOVE on them; it's ok to move them around, and
   if all references to them get dropped, it's fine to eliminate them.
 - Insert them immediately after their lexically-last predecessor when
   generating them; this increases the likelihood of using fallthrough
   rather than gotos to target them in the face of fgReorderBlocks'
   reticence to reorder code that we don't have IBC data for and that
   hasn't been marked rare.
 - Make fgReorderBlocks slightly more aggressive for a pattern that now
   shows up somewhat routinely for returning compound conditionals from
   predicate functions.
src/jit/flowgraph.cpp
tests/src/JIT/opt/Loops/SearchLoopTail.cs