Permalink
Browse files

SI-4859 Retain MODULE_LOAD in dead code elim.

Without this, the following test fails:

    SCALAC_OPTS="-optimize" ./test/partest test/files/run/t4859.scala
  • Loading branch information...
1 parent f21b1ce commit 412ad5724c0ca34f5fd6982ff6a0b12a437218bc @retronym retronym committed Jan 7, 2013
@@ -144,6 +144,8 @@ abstract class DeadCodeElimination extends SubComponent {
}
}
if (necessary) worklist += ((bb, idx))
+ case LOAD_MODULE(sym) if isLoadNeeded(sym) =>
+ worklist += ((bb, idx)) // SI-4859 Module initialization might side-effect.
case _ => ()
}
rd = rdef.interpret(bb, idx, rd)
@@ -15,7 +15,7 @@ object Outer {
object Test {
def main(args: Array[String]) {
- Outer.Inner.i // we still don't initiialize Outer here (but should we?)
+ Outer.Inner.i // we still don't initialize Outer here (but should we?)
{println("About to reference Inner.i"); Outer}.Inner.i // Outer will be initialized.

0 comments on commit 412ad57

Please sign in to comment.