r199302 - CodeGen: Simplify CodeGenFunction::EmitCaseStmt

Chandler Carruth chandlerc at google.com
Tue Jan 14 23:52:06 PST 2014


On Tue, Jan 14, 2014 at 11:30 PM, Justin Bogner <mail at justinbogner.com>wrote:

> Author: bogner
> Date: Wed Jan 15 01:30:30 2014
> New Revision: 199302
>
> URL: http://llvm.org/viewvc/llvm-project?rev=199302&view=rev
> Log:
> CodeGen: Simplify CodeGenFunction::EmitCaseStmt
>
> Way back in r129652 we tried to avoid emitting an empty block at -O0
> for switch cases that did nothing but break. This led to a poor
> debugging experience as reported in PR9796, so we disabled the
> optimization for -O0 but left it in for higher optimization levels in
> r154420.
>
> Since the whole point of this was to improve -O0, it's silly to keep
> the complexity at all.
>

Hold on, I don't think that's the right way to interpret this.

Allocating, wiring up, optimizing and deleting the block all have very
non-trivial compile-time cost. They introduce guaranteed malloc traffic.
Worse, linear amounts of malloc traffic.

It seems very worth a small amount of complexity in clang to emit more
minimal IR. While I'm OK keeping these blocks when we need them (for
whatever reason, debugging, profiling, whatever), I don't think we should
unilaterally keep them.

I can move the discussion to the code review thread if you'd like, but this
commit seemed to take things a significant step further than was discussed
in that thread by *always* keeping these blocks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140114/aa816210/attachment.html>


More information about the cfe-commits mailing list