Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Issue 10446098: Avoid generating empty else. (Closed)

Created:
8 years, 6 months ago by ngeoffray
Modified:
8 years, 6 months ago
CC:
reviews_dartlang.org, karlklose, ahe, floitsch
Visibility:
Public.

Description

Avoid generating empty else. Committed: https://code.google.com/p/dart/source/detail?r=8149

Patch Set 1 : #

Total comments: 20

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+39 lines, -4 lines) Patch
M lib/compiler/implementation/ssa/codegen.dart View 1 2 3 5 chunks +38 lines, -4 lines 0 comments Download
M lib/compiler/implementation/ssa/variable_allocator.dart View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
ngeoffray
8 years, 6 months ago (2012-05-31 10:42:58 UTC) #1
kasperl
LGTM. https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implementation/ssa/codegen.dart File lib/compiler/implementation/ssa/codegen.dart (right): https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implementation/ssa/codegen.dart#newcode558 lib/compiler/implementation/ssa/codegen.dart:558: generateStatements(info.elseGraph); info.elseGraph -> elseGraph https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implementation/ssa/codegen.dart#newcode1257 lib/compiler/implementation/ssa/codegen.dart:1257: bool hasCodeUntil(HBasicBlock ...
8 years, 6 months ago (2012-05-31 11:26:34 UTC) #2
ngeoffray
Thanks Kasper https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implementation/ssa/codegen.dart File lib/compiler/implementation/ssa/codegen.dart (right): https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implementation/ssa/codegen.dart#newcode558 lib/compiler/implementation/ssa/codegen.dart:558: generateStatements(info.elseGraph); On 2012/05/31 11:26:34, kasperl wrote: > ...
8 years, 6 months ago (2012-05-31 11:51:28 UTC) #3
Lasse Reichstein Nielsen
LGTM with comments. https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implementation/ssa/codegen.dart File lib/compiler/implementation/ssa/codegen.dart (right): https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implementation/ssa/codegen.dart#newcode553 lib/compiler/implementation/ssa/codegen.dart:553: HIf ifInstruction = info.thenGraph.start.predecessors[0].last; Or: HIf ...
8 years, 6 months ago (2012-05-31 11:57:27 UTC) #4
ngeoffray
8 years, 6 months ago (2012-05-31 12:27:38 UTC) #5
Thanks Lasse.

https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implem...
File lib/compiler/implementation/ssa/codegen.dart (right):

https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implem...
lib/compiler/implementation/ssa/codegen.dart:553: HIf ifInstruction =
info.thenGraph.start.predecessors[0].last;
On 2012/05/31 11:57:28, Lasse Reichstein Nielsen wrote:
> Or:
>  HIf ifInstruction = info.condition.conditionExpression;

Done.

https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implem...
lib/compiler/implementation/ssa/codegen.dart:555: &&
hasCodeUntil(elseGraph.start, ifInstruction.joinBlock)) {
On 2012/05/31 11:57:28, Lasse Reichstein Nielsen wrote:
> I really, really don't like using the ifInstruction's joinBlock in the
> block-structure based handling. 
> 
> How about working on the closed interval that is the elseGraph, i.e.
>   hasCodeUntil(elseGraph.start, elseGraph.end) 
> here and
>   hasCodeUntil(node.elseBlock, node.joinBlock.predecessor[1])
> below? 

Done.

https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implem...
lib/compiler/implementation/ssa/codegen.dart:1258: if (block.last is !HGoto)
return true;
On 2012/05/31 11:57:28, Lasse Reichstein Nielsen wrote:
> Sadly, HBreak and HContinue are subclasses of HGoto.
> We should probably change that, it keeps tripping me up too.

+1

https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implem...
lib/compiler/implementation/ssa/codegen.dart:1262: while (instruction !=
block.last) {
On 2012/05/31 11:57:28, Lasse Reichstein Nielsen wrote:
> for-loop?

Done.

https://chromiumcodereview.appspot.com/10446098/diff/2001/lib/compiler/implem...
lib/compiler/implementation/ssa/codegen.dart:1272: if (sourceName !=
destinationName) return true;
On 2012/05/31 11:57:28, Lasse Reichstein Nielsen wrote:
> Would it make sense to remove these "identity-copies", or is there a reason to
> keep them?

At the time where we create the copies of HInstruction, we actually don't know
if they are identity copies. I could remove them once we have done the
allocation of variable names, but it felt just easier to just let the algorithm
that sequentializes the copies do it.

Powered by Google App Engine
This is Rietveld 408576698