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

Unified Diff: dart/frog/leg/ssa/phi_eliminator.dart

Issue 9025012: New bugfix for phi eliminator: if a loop phi is used after its update, the load of the phi must n... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dart/tests/language/language-leg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/frog/leg/ssa/phi_eliminator.dart
===================================================================
--- dart/frog/leg/ssa/phi_eliminator.dart (revision 2753)
+++ dart/frog/leg/ssa/phi_eliminator.dart (working copy)
@@ -125,11 +125,25 @@
currentBlock.rewrite(phi, load);
currentBlock.removePhi(phi);
- if (!currentBlock.isLoopHeader() || !hasLoopPhiAsInput(stores, loads)) {
+ if (currentBlock.isLoopHeader()) {
+ if (!hasLoopPhiAsInput(stores, loads) &&
+ !isUsedAfterStores(stores[1], load)) {
kasperl 2011/12/22 15:11:54 Is stores[1] guaranteed to be the last store. I gu
ngeoffray 2011/12/22 15:15:10 On a loop phi we currently have the assumption tha
+ load.setGenerateAtUseSite();
+ }
+ } else {
load.setGenerateAtUseSite();
}
}
+ bool isUsedAfterStores(HStore update, HLoad load) {
+ // [update] is the store of the loop phi for the back edge.
+ // [load] is the replacement of the loop phi.
+ for (HInstruction instruction in load.usedBy) {
+ if (instruction.block.id >= update.value.block.id) return true;
+ }
+ return false;
+ }
+
bool hasLoopPhiAsInput(List<HStore> stores, List<HLoad> loads) {
// [stores] contains the stores of a specific phi.
// [loads] contains the phis that were converted to loads.
« no previous file with comments | « no previous file | dart/tests/language/language-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698