[PATCH] D92882: [MBP] Prevent rotating a chain contains entry block

Guozhi Wei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 10 17:57:22 PST 2020


Carrot added a comment.

In D92882#2444285 <https://reviews.llvm.org/D92882#2444285>, @davidxl wrote:

> It is possible to synthesize a test case that rotates the entry without the fix, no? The expected output is that the entry is not rotated (no need to reproduce crash).

The key is to generate an entry block and make the following condition in buildCFGChains() evaluated as false:

  if (!TII->analyzeBranch(*BB, TBB, FBB, Cond) || !FI->canFallThrough())
    break;

It means the entry block must end with an unanalyzable branch and it must also fall through to following block, so the entry block will be pre-merged with the following block, the following block is a loop header, so later it can be rotated by rotateLoop.

I failed to construct such a test case after a whole day's experiments :(


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92882



More information about the llvm-commits mailing list