[Reading from terminal...]
%x = sub %A, 0
%y = add %x, C2
%r = add %y, C3
=>
%x = %A
%r = add %y, C3
----------------------------------------
Optimization: 1
Precondition: true
%x = sub %A, 0
%y = add %x, C2
%r = add %y, C3
=>
%x = %A
%r = add %y, C3
Traceback (most recent call last):
File "./alive.py", line 526, in <module>
main()
File "./alive.py", line 517, in main
check_opt(opt)
File "./alive.py", line 460, in check_opt
check_typed_opt(pre, src, ident_src, tgt, ident_tgt, types, users)
File "./alive.py", line 340, in check_typed_opt
tgtv = toSMT(tgt, ident_tgt, False)
File "/Users/dave/Documents/Research/alive/alive/language.py", line 1170, in toSMT
smt = v.toSMT(defined, poison, state, qvars)
File "/Users/dave/Documents/Research/alive/alive/language.py", line 357, in toSMT
v1 = state.eval(self.v1, defined, poison, qvars)
File "/Users/dave/Documents/Research/alive/alive/language.py", line 151, in eval
(smt, d, p, q) = self.vars[v.getUniqueName()]
KeyError: '%x'
Alternately, we could disallow replacement for non-roots entirely. In the Alive suite, we only seem to do it for values which also have HasOneUse, so there's on real difference between replacement and just creating a new value. (See also #26.)
For example, Alive will crash if I have an instruction
%rin the target which depends on%yfrom the source, but%ydepends on a value%xwhich is replaced in the target.Either
%yneeds to be reevaluated in the target, or we should disallow replacing values that are used by non-replaced values.Alternately, we could disallow replacement for non-roots entirely. In the Alive suite, we only seem to do it for values which also have
HasOneUse, so there's on real difference between replacement and just creating a new value. (See also #26.)