-
Notifications
You must be signed in to change notification settings - Fork 13
Closed
Labels
bugSomething isn't workingSomething isn't workingoptimizerRelated to the code optimizerRelated to the code optimizer
Description
Loop hoisting may hoist assignments in front of the loop even when the loop is not guaranteed to run:
#set target = 8;
param a = 10;
b = a;
while rand(10) > 10 do
b = 2 * a;
print(b);
end;
print(b);
compiles to
set a 10
op mul :b 2 a
op rand *tmp0 10 0
jump label_7 lessThanEq *tmp0 10
label_4:
print :b
op rand *tmp0 10 0
jump label_4 greaterThan *tmp0 10
label_7:
print :b
This loop doesn't execute (obviously), but the program prints 20.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingoptimizerRelated to the code optimizerRelated to the code optimizer