Question about ExtractLoop


I have a question about ExtractLoop() in CodeExtractor.cpp.

The sample code is a simple list traversal, as attached. The generated bitcode (from llvm-gcc -O1) is shown below.

le.c (1.01 KB)


This is a follow-up to the previous question about ExtractLoop().

I just found that the live-outs are same for all the loop exit blocks (in the current implementation of loop extraction). If we remember the live-outs for each exit block (this can be done in findInputsOutputs()), and store the necessary live-outs at each exit block (in emitCallAndSwitchStatement()), then we may not need to do the dominance check.

Does anyone have any idea on this?

Thanks a lot.