On Apr 16, 2011, at 5:54 PM, Chris Lattner wrote:
> Author: lattner
> Date: Sat Apr 16 19:54:30 2011
> New Revision: 129652
>
> URL: http://llvm.org/viewvc/llvm-project?rev=129652&view=rev
> Log:
> implement rdar://9289524 - case followed immediately by break results in
> empty IR block,
> a -O0 code quality issue.
Awesome, thanks!
> + // If the body of the case is just a 'break', try to not emit an empty
> block.
> + if (isa<BreakStmt>(S.getSubStmt())) {
> + JumpDest Block = BreakContinueStack.back().BreakBlock;
> +
> + // Only do this optimization if there are no cleanups that need emitting.
> + if (isObviouslyBranchWithoutCleanups(Block)) {
> + llvm::APSInt CaseVal = S.getLHS()->EvaluateAsInt(getContext());
This is common between these two code paths and would be nice to hoist.
John.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits