Permalink
Browse files

hir: fix reordering for loop-effected code

  • Loading branch information...
indutny committed Nov 21, 2012
1 parent da5e59b commit ecfcae449d4eba5e8607897cef1caaaf0ac04cff
Showing with 16 additions and 2 deletions.
  1. +1 −0 Makefile
  2. +2 −2 src/hir.cc
  3. +13 −0 test/functional/regressions/regr-5.can
View
@@ -45,6 +45,7 @@ test: test-runner can
@./can test/functional/regressions/regr-2.can
@./can test/functional/regressions/regr-3.can
@./can test/functional/regressions/regr-4.can
+ @./can test/functional/regressions/regr-5.can
lint:
@./tools/presubmit.py
View
@@ -76,11 +76,11 @@ void HIRGen::Build(AstNode* root) {
set_current_root(NULL);
// Optimize
- PrunePhis();
FindReachableBlocks();
DeriveDominators();
- EliminateDeadCode();
FindEffects();
+ PrunePhis();
+ EliminateDeadCode();
GlobalValueNumbering();
GlobalCodeMotion();
@@ -0,0 +1,13 @@
+print = global.print
+assert = global.assert
+
+print("-- can: hir regr#5 --")
+
+test(a, items...) {
+ while (i < sizeof items) {
+ a[sizeof a] = items[i++]
+ }
+
+ assert(sizeof a == 6, "Sizeof and store property")
+}
+test([1,2,3], 1,2,3)

0 comments on commit ecfcae4

Please sign in to comment.