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

Side by Side Diff: runtime/vm/compiler.cc

Issue 2709093003: Fixup redefinitions before doing code motion (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/flow_graph.h » ('j') | runtime/vm/flow_graph.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 884 DEBUG_ASSERT(flow_graph->VerifyUseLists());
885 // Canonicalization introduced more opportunities for constant 885 // Canonicalization introduced more opportunities for constant
886 // propagation. 886 // propagation.
887 ConstantPropagator::Optimize(flow_graph); 887 ConstantPropagator::Optimize(flow_graph);
888 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 888 DEBUG_ASSERT(flow_graph->VerifyUseLists());
889 } 889 }
890 890
891 // Optimistically convert loop phis that have a single non-smi input 891 // Optimistically convert loop phis that have a single non-smi input
892 // coming from the loop pre-header into smi-phis. 892 // coming from the loop pre-header into smi-phis.
893 if (FLAG_loop_invariant_code_motion) { 893 if (FLAG_loop_invariant_code_motion) {
894 flow_graph->FixupRedefinitions();
895 DEBUG_ASSERT(flow_graph->VerifyRedefinitions());
894 LICM licm(flow_graph); 896 LICM licm(flow_graph);
895 licm.OptimisticallySpecializeSmiPhis(); 897 licm.OptimisticallySpecializeSmiPhis();
Vyacheslav Egorov (Google) 2017/02/23 13:47:27 I think we don't need to fixup redefinitions here
Florian Schneider 2017/02/23 19:26:35 Done.
896 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 898 DEBUG_ASSERT(flow_graph->VerifyUseLists());
897 } 899 }
898 900
899 // Propagate types and eliminate even more type tests. 901 // Propagate types and eliminate even more type tests.
900 // Recompute types after constant propagation to infer more precise 902 // Recompute types after constant propagation to infer more precise
901 // types for uses that were previously reached by now eliminated phis. 903 // types for uses that were previously reached by now eliminated phis.
902 FlowGraphTypePropagator::Propagate(flow_graph); 904 FlowGraphTypePropagator::Propagate(flow_graph);
903 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 905 DEBUG_ASSERT(flow_graph->VerifyUseLists());
904 906
905 { 907 {
(...skipping 12 matching lines...) Expand all
918 920
919 { 921 {
920 NOT_IN_PRODUCT(TimelineDurationScope tds2( 922 NOT_IN_PRODUCT(TimelineDurationScope tds2(
921 thread(), compiler_timeline, "CommonSubexpressionElinination")); 923 thread(), compiler_timeline, "CommonSubexpressionElinination"));
922 if (FLAG_common_subexpression_elimination || 924 if (FLAG_common_subexpression_elimination ||
923 FLAG_loop_invariant_code_motion) { 925 FLAG_loop_invariant_code_motion) {
924 flow_graph->ComputeBlockEffects(); 926 flow_graph->ComputeBlockEffects();
925 } 927 }
926 928
927 if (FLAG_common_subexpression_elimination) { 929 if (FLAG_common_subexpression_elimination) {
928 if (DominatorBasedCSE::Optimize(flow_graph)) { 930 if (DominatorBasedCSE::Optimize(flow_graph)) {
Vyacheslav Egorov (Google) 2017/02/23 13:47:26 We do load forwarding here so we might introduce n
Florian Schneider 2017/02/23 19:26:35 Done.
929 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 931 DEBUG_ASSERT(flow_graph->VerifyUseLists());
930 flow_graph->Canonicalize(); 932 flow_graph->Canonicalize();
931 // Do another round of CSE to take secondary effects into account: 933 // Do another round of CSE to take secondary effects into account:
932 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) 934 // e.g. when eliminating dependent loads (a.x[0] + a.x[0])
933 // TODO(fschneider): Change to a one-pass optimization pass. 935 // TODO(fschneider): Change to a one-pass optimization pass.
934 if (DominatorBasedCSE::Optimize(flow_graph)) { 936 if (DominatorBasedCSE::Optimize(flow_graph)) {
935 flow_graph->Canonicalize(); 937 flow_graph->Canonicalize();
936 } 938 }
937 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 939 DEBUG_ASSERT(flow_graph->VerifyUseLists());
938 } 940 }
939 } 941 }
940 942
941 // Run loop-invariant code motion right after load elimination since 943 // Run loop-invariant code motion right after load elimination since
942 // it depends on the numbering of loads from the previous 944 // it depends on the numbering of loads from the previous
943 // load-elimination. 945 // load-elimination.
944 if (FLAG_loop_invariant_code_motion) { 946 if (FLAG_loop_invariant_code_motion) {
945 LICM licm(flow_graph); 947 LICM licm(flow_graph);
Vyacheslav Egorov (Google) 2017/02/23 13:47:27 I think we should fixup redefinitions here.
Florian Schneider 2017/02/23 19:26:35 Done.
946 licm.Optimize(); 948 licm.Optimize();
947 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 949 DEBUG_ASSERT(flow_graph->VerifyUseLists());
948 } 950 }
949 flow_graph->RemoveRedefinitions(); 951 flow_graph->RemoveRedefinitions();
950 } 952 }
951 953
952 // Optimize (a << b) & c patterns, merge operations. 954 // Optimize (a << b) & c patterns, merge operations.
953 // Run after CSE in order to have more opportunity to merge 955 // Run after CSE in order to have more opportunity to merge
954 // instructions that have same inputs. 956 // instructions that have same inputs.
955 flow_graph->TryOptimizePatterns(); 957 flow_graph->TryOptimizePatterns();
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
2265 2267
2266 2268
2267 bool BackgroundCompiler::IsDisabled() { 2269 bool BackgroundCompiler::IsDisabled() {
2268 UNREACHABLE(); 2270 UNREACHABLE();
2269 return true; 2271 return true;
2270 } 2272 }
2271 2273
2272 #endif // DART_PRECOMPILED_RUNTIME 2274 #endif // DART_PRECOMPILED_RUNTIME
2273 2275
2274 } // namespace dart 2276 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph.h » ('j') | runtime/vm/flow_graph.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698