llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.38k stars 12.15k forks source link

In llvmIR cfg , can loop exit bb has multi pred_bbs which are inside the loop body? #61093

Closed PressFforlove closed 1 year ago

PressFforlove commented 1 year ago

i am solving a scc algrithm, which request me to break a loop region's circle layer by layer(the loop is nested) , i have solved the situation which the entry and exit of the loop is different, but i encountered a problem when i try to fix the problem of the entry == exit. When i try to assume that the exit bb of the loop has only one pred bb which is included in the loop body, it's easy to break the circle by break the edge of exit bb's In_loop_pred_bb in graph and rgraph. But if not, this way will break multi circles when exit has multi in_loop_pred_bbs, which prevent me from forming loop regions one by one. I am not sure the assumption is absolutely right. In my opinion, the return point manager of a loop should be a data structure of a stack, which may prove the assumption. can some body help me please?

fhahn commented 1 year ago

For question about LLVM, please use https://discourse.llvm.org. The Github issue tracker is for reporting issues and bugs.

There's nothing preventing a loop having multiple exiting blocks to the same exit block in LLVM IR AFAICT

PressFforlove commented 1 year ago

thank you