[PATCH] Remove dead code from LoopUnswitch

Andrew Trick atrick at apple.com
Mon Nov 4 21:52:21 PST 2013


On Oct 26, 2013, at 11:09 PM, Hal Finkel <hfinkel at anl.gov> wrote:

> Chris, et al.,
> 
> LoopUnswitch's code simplification routine has code to convert conditional to unconditional branches, after unswitching makes the condition constant, and then remove any blocks that renders dead. Unfortunately, this code is dead, currently broken, and furthermore, has never been alive (at least as far back at 2006). I propose that, at least for now, we nuke it.
> 
> Regarding the general functionality, I see (at least) two possible options:
> 
> 1. Fix/rewrite this functionality within LoopUnswitch
> 
> 2. Run SimplifyCFG after running LoopUnswitch: we currently run InstCombine after running LoopUnswitch, and so the loop pass manager is already done after running LoopUnswitch, and SE is already being invalidated by InstCombine, so it does not look like, if we added SimplifyCFG after InstCombine, we'd really lose much.
> 
> Thoughts?

Hi Hal,

SimplifyCFG does run after Unswitch... way after. But at least it will be rerun before any other loop opts, like Vectorizer. Actually I think SCCP would catch this first.
The problem with running SimplifyCFG in between loop pass managers is that it invalidates loop info. 

Which pass are you concerned will see the dead blocks? GVN? 

Long term I envision the pass order looking like: GVN -> Unswitch -> SCCP -> … -> LoopVectorize.

-Andy





More information about the llvm-commits mailing list