Export to GitHub

spitfire - issue #5

Loop invariant hoisting optimization generates broken code


Posted on Jan 25, 2010 by Swift Kangaroo

Source:

for $x in $foobar

#set $broken_variable = 'test'
$broken_variable

end for

With -O4, this compiles to:

_fphB50896DF = _self_filter_function(broken_variable) # << use before 

definition for x in _rph_foobar: broken_variable = u'test'

The stop-gap fix is (checked in r115) is to not hoist any variables that have other dependencies in the loop. A warning is emitted instead. Long term fix should be to hoist both the loop invariant variable and all invariant dependencies.

Status: Fixed

Labels:
Type-Defect Priority-Medium