Mesa (master): gallivm: fix nested break and continue statements

Zack Rusin zack at kemper.freedesktop.org
Mon May 3 01:37:26 UTC 2010


Module: Mesa
Branch: master
Commit: d2b6ed7c4daf094bfe3fa4e0318133d0a8ea3cf6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d2b6ed7c4daf094bfe3fa4e0318133d0a8ea3cf6

Author: Zack Rusin <zackr at vmware.com>
Date:   Sun May  2 21:40:30 2010 -0400

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)

---

 src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
index d3c769e..f49f278 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
@@ -255,16 +255,9 @@ static void lp_exec_break(struct lp_exec_mask *mask)
                                          mask->exec_mask,
                                          "break");
 
-   /* mask->break_stack_size > 1 implies that we encountered a break
-    * statemant already and if that's the case we want to make sure
-    * our mask is a combination of the previous break and the current
-    * 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;
+   mask->break_mask = LLVMBuildAnd(mask->bld->builder,
+                                   mask->break_mask,
+                                   exec_mask, "break_full");
 
    lp_exec_mask_update(mask);
 }
@@ -275,12 +268,9 @@ static void lp_exec_continue(struct lp_exec_mask *mask)
                                          mask->exec_mask,
                                          "");
 
-   if (mask->cont_stack_size > 1) {
-      mask->cont_mask = LLVMBuildAnd(mask->bld->builder,
-                                     mask->cont_mask,
-                                     exec_mask, "");
-   } else
-      mask->cont_mask = exec_mask;
+   mask->cont_mask = LLVMBuildAnd(mask->bld->builder,
+                                  mask->cont_mask,
+                                  exec_mask, "");
 
    lp_exec_mask_update(mask);
 }




More information about the mesa-commit mailing list