[PATCH] D81835: [SimplifyCFG] Fix inconsistency in block size assessment for threading

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 23:04:16 PDT 2020


mkazantsev closed this revision.
mkazantsev added a comment.

  commit f01d9e6fc3e291a2faed8c9b7dcbabf760f32bd6
  Author: Max Kazantsev <mkazantsev at azul.com>
  Date:   Tue Jun 30 12:38:15 2020 +0700
  
      [SimplifyCFG] Fix inconsistency in block size assessment for threading
  
      Sometimes SimplifyCFG may decide to perform jump threading. In order
      to do it, it follows the following algorithm:
  
      1. Checks if the block is small enough for threading;
      2. If yes, inserts a PR Phi relying that the next iteration will remove it
         by performing jump threading;
      3. The next iteration checks the block again and performs the threading.
  
      This logic has a corner case: inserting the PR Phi increases block's size
      by 1. If the block size at first check was max possible, one more Phi will
      exceed this size, and we will neither perform threading nor remove the
      created Phi node. As result, we will end up with worse IR than before.
  
      This patch fixes this situation by excluding Phis from block size computation.
      Excluding Phis from size computation for threading also makes sense by
      itself because in case of threadign all those Phis will be removed.
  
      Differential Revision: https://reviews.llvm.org/D81835
      Reviewed By: asbirlea, nikic


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81835/new/

https://reviews.llvm.org/D81835





More information about the llvm-commits mailing list