[llvm-commits] patch: preserve branch to unreachable until codegenprep time
Nick Lewycky
nicholas at mxc.ca
Sun Feb 7 14:22:23 PST 2010
Chris Lattner wrote:
>
> On Oct 18, 2009, at 10:11 AM, Dan Gohman wrote:
>
>>
>>
>> On Oct 18, 2009, at 12:16 AM, Nick Lewycky <nicholas at mxc.ca> wrote:
>>
>>> This patch moves the code that optimizes "branch to unreachable"
>>> from SimplifyCFG to CodeGenPrep. Most of this patch is just updating
>>> the unit tests that use unreachable everywhere. I've done my best to
>>> preserve the intent of the tests.
>>
>> I haven't read the patch, but I'm concerned about this interfering
>> with other optimizations. Deleting the condition can expose further
>> dce and related optimizations. Also if the branch is a loop exit,
>> deleting it makes it easier to compute a trip count.
>
> I agree, but I still think this is a good idea. :)
>
> LSR and other passes can special case this for trip count handling. We
> can make simplifycfg delete the branch to unreachable if the condition
> is "too complicated" to be useful for the optimizer.
What would you consider 'too complicated' here? Offhand I think the
unladen-swallow use case involves load(s)+and/or+icmp, so we need to
support that at a bare minimum.
Or do you want to try it out without such an optimization and add it in
when we encounter cases it should've snipped?
Nick
> One area that does concern me is in the various code size evaluations
> (inlining, jump threading, unswitch, ...). This feature will make those
> completely wrong for code involved in these sorts of checks.
>
> -Chris
>
More information about the llvm-commits
mailing list