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

Issue 10943007: Initial implementation of sparse conditional constant propagation. (Closed)

Created:
8 years, 3 months ago by Kevin Millikin (Google)
Modified:
8 years, 3 months ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Initial implementation of sparse conditional constant propagation. Use the results of SCC to eliminate unreachable code. BUG= Committed: https://code.google.com/p/dart/source/detail?r=12549

Patch Set 1 #

Total comments: 13
Unified diffs Side-by-side diffs Delta from patch set Stats (+1110 lines, -242 lines) Patch
M runtime/lib/integers.cc View 14 chunks +14 lines, -181 lines 0 comments Download
M runtime/vm/compiler.cc View 2 chunks +6 lines, -7 lines 0 comments Download
M runtime/vm/flow_graph.h View 1 chunk +3 lines, -4 lines 0 comments Download
M runtime/vm/flow_graph.cc View 9 chunks +16 lines, -23 lines 0 comments Download
M runtime/vm/flow_graph_optimizer.h View 1 chunk +63 lines, -0 lines 0 comments Download
M runtime/vm/flow_graph_optimizer.cc View 2 chunks +702 lines, -0 lines 13 comments Download
M runtime/vm/intermediate_language.h View 13 chunks +42 lines, -19 lines 0 comments Download
M runtime/vm/intermediate_language.cc View 6 chunks +87 lines, -8 lines 0 comments Download
M runtime/vm/object.h View 2 chunks +10 lines, -0 lines 0 comments Download
M runtime/vm/object.cc View 2 chunks +167 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Kevin Millikin (Google)
This is ready for initial reviews. It's a complicated change because it contains code for ...
8 years, 3 months ago (2012-09-18 10:34:15 UTC) #1
Florian Schneider
LGTM. https://codereview.chromium.org/10943007/diff/1/runtime/vm/flow_graph_optimizer.cc File runtime/vm/flow_graph_optimizer.cc (right): https://codereview.chromium.org/10943007/diff/1/runtime/vm/flow_graph_optimizer.cc#newcode1829 runtime/vm/flow_graph_optimizer.cc:1829: void ConstantPropagator::Join(Object& left, const Object& right) { Is ...
8 years, 3 months ago (2012-09-18 12:41:52 UTC) #2
Florian Schneider
Can you achieve that by just calling ComputeUseLists() again after your transformation? > It's fishy ...
8 years, 3 months ago (2012-09-18 12:45:20 UTC) #3
Kevin Millikin (Google)
8 years, 3 months ago (2012-09-19 07:10:01 UTC) #4
Simply calling ComputeUseLists() does not work.  It walks the dominator tree to
clear the existing use lists before recomputing them --- so it will never find
and remove uses in unreachable blocks.

https://codereview.chromium.org/10943007/diff/1/runtime/vm/flow_graph_optimiz...
File runtime/vm/flow_graph_optimizer.cc (right):

https://codereview.chromium.org/10943007/diff/1/runtime/vm/flow_graph_optimiz...
runtime/vm/flow_graph_optimizer.cc:1829: void ConstantPropagator::Join(Object&
left, const Object& right) {
On 2012/09/18 12:41:52, Florian Schneider wrote:
> Is it possible to use a pointer for the output parameter? We normally don't
pass
> non-const references as parameters.

Done.

https://codereview.chromium.org/10943007/diff/1/runtime/vm/flow_graph_optimiz...
runtime/vm/flow_graph_optimizer.cc:2024: SetValue(instr, non_constant_);
On 2012/09/18 12:41:52, Florian Schneider wrote:
> Some instructions can't occur in SSA form: UNREACHABLE()?

Done.

https://codereview.chromium.org/10943007/diff/1/runtime/vm/flow_graph_optimiz...
runtime/vm/flow_graph_optimizer.cc:2381: // OS::Print("Working on definition
#%d\n", definition->ssa_temp_index());
On 2012/09/18 12:41:52, Florian Schneider wrote:
> Remove print or put it under a flag.

Removed.

https://codereview.chromium.org/10943007/diff/1/runtime/vm/flow_graph_optimiz...
runtime/vm/flow_graph_optimizer.cc:2383:
definition_marks_->Remove(definition->ssa_temp_index());
On 2012/09/18 12:41:52, Florian Schneider wrote:
> I don't see definition_marks_ used anywhere. Did you forget to check it to
avoid
> adding duplicates to the definition_worklist_?

Oops.  It's been added as a check to avoid duplicates in SetValue.

https://codereview.chromium.org/10943007/diff/1/runtime/vm/flow_graph_optimiz...
runtime/vm/flow_graph_optimizer.cc:2455: } else if
(!reachable_->Contains(if_false->preorder_number())) {
On 2012/09/18 12:41:52, Florian Schneider wrote:
> The code inside this if-statement seems duplicated except the assignment to
> join. Maybe change it to sth. like:
> 
> JoinEntryInstr* join = NULL;
> if (!reachable_->Contains(if_true->preorder_number())) {
>   join = new JoinEntryInstr(if_false->try_index());
> } else if (!reachable_->Contains(if_false->preorder_number())) {
>   join = new JoinEntryInstr(if_true->try_index());
> }
> 
> if (join != NULL) {
>   GotoInstr* jump = new GotoInstr(join);
>   Instruction* previous = branch->previous();
>   branch->set_previous(NULL);
>   previous->set_next(jump);
>  
>   Instruction* next = if_true->next();
>   join->set_next(next);
> }

Done.

Powered by Google App Engine
This is Rietveld 408576698