-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The expression class enforces a rule that disallows
The rule should just enforce that nested
For example, consider code/gvn/flow/lift_to_max.ami, which in pseudocode is
x = read()
y = read()
if x > y:
x, y = y, x
while x < y:
x += 1
write(x)
write(y)Below is equivalent, simplified ami code:
@enter:
read %x.0
read %y.0
%flip = %y.0 < %x.0
branch %flip ? @flip : @loop
@flip:
%x.1 = %y.0
%y.1 = %x.0
goto @loop
@loop:
%x.2 = phi [ %x.0, @enter ], [ %x.1, @flip ], [ %x.3, @iterate ]
%y.2 = phi [ %y.0, @enter ], [ %y.1, @flip ], [ %y.2, @iterate ]
%delta = %x.2 < %y.2
branch %delta ? @iterate : @done
@iterate:
%x.3 = %x.2 + 1
goto @loop
@done:
write %x.2
write %y.2
exit
The current implementation of Gargi's GVN algorithm assigns
We should be able to infer from this that @loop branch condition is false, conclude that