The entry block should always be the first BB in a function. So we should not rotate a chain contains the entry block.
It doesn't have any performance impact.
If user doesn't notice anything, there is no such case for them.
If someone encountered such case, he should get a compiler crash in LiveDebugVariable pass.
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 :(