[PATCH] [PR18861] Fix for LoopUnroll pass was breaking LCSSA form while completely removing loop

Dinesh Dwivedi dinesh.d at samsung.com
Fri May 9 16:38:41 PDT 2014

Thanks, I agree that I don't understand complete flow and internals.

But While debugging for this bug, I observed that there are only 2 places we are messing 
up with PHI nodes during LoopUnrool pass, one in FoldBlockIntoPredecessor() while folding 
single entry PHI nodes and other during loop simplify.

For issue due to loop simplify, Chandler has added formLCSSARecursively() for parent loop
if current loop is unrolled completely. I saw that if we run formLCSSARecursively() on the 
root node of the loop nest, it fixes this bug too. But as this was temporary fix as per chandler, 
I started looking to completely avoid formLCSSARecursively.

This patch tries to fix PHIs deleted by FoldBlockIntoPredecessor. I had send another patch 
to keep PHIs nodes from deletion while simplifying loop.

I assumed that if loop was in LCSSA and we keep/ re-insert deleted PHI nodes which was 
there only to keep loop in LCSSA form, that will ensure that loop will be in LCSSA after pass
and will take care of all corner cases. But I may be wrong.

I will try to update patch as per your suggestions. 

Again thanks for review and suggestions :).


More information about the llvm-commits mailing list