gallivm: fix nested break and continue statements

we were resetting the mask on each new break/continue statement within
the same scope. we always need to and the current execution mask
with the current break/continue mask to get the correct result (the
masks are always ~1 initially)
This commit is contained in:
Zack Rusin 2010-05-02 21:40:30 -04:00
parent c2c1f60391
commit d2b6ed7c4d

View file

@ -255,16 +255,9 @@ static void lp_exec_break(struct lp_exec_mask *mask)
mask->exec_mask, mask->exec_mask,
"break"); "break");
/* mask->break_stack_size > 1 implies that we encountered a break mask->break_mask = LLVMBuildAnd(mask->bld->builder,
* statemant already and if that's the case we want to make sure mask->break_mask,
* our mask is a combination of the previous break and the current exec_mask, "break_full");
* execution mask */
if (mask->break_stack_size > 1) {
mask->break_mask = LLVMBuildAnd(mask->bld->builder,
mask->break_mask,
exec_mask, "break_full");
} else
mask->break_mask = exec_mask;
lp_exec_mask_update(mask); lp_exec_mask_update(mask);
} }
@ -275,12 +268,9 @@ static void lp_exec_continue(struct lp_exec_mask *mask)
mask->exec_mask, mask->exec_mask,
""); "");
if (mask->cont_stack_size > 1) { mask->cont_mask = LLVMBuildAnd(mask->bld->builder,
mask->cont_mask = LLVMBuildAnd(mask->bld->builder, mask->cont_mask,
mask->cont_mask, exec_mask, "");
exec_mask, "");
} else
mask->cont_mask = exec_mask;
lp_exec_mask_update(mask); lp_exec_mask_update(mask);
} }