aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/program/prog_optimize.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-04-01 12:04:34 +0000
committermarha <marha@users.sourceforge.net>2011-04-01 12:04:34 +0000
commit0fd309bfed8f9f61a8ea8bbbe7628d0af471c070 (patch)
tree97a335ffb903e9cf159322f3906f9cb71d660d9c /mesalib/src/mesa/program/prog_optimize.c
parentdab40e0df33e80dab53b4ca20760c1fb4388649b (diff)
parent5d8e1ad0cd01de0bd0b43dc916c1d39fd293e79d (diff)
downloadvcxsrv-0fd309bfed8f9f61a8ea8bbbe7628d0af471c070.tar.gz
vcxsrv-0fd309bfed8f9f61a8ea8bbbe7628d0af471c070.tar.bz2
vcxsrv-0fd309bfed8f9f61a8ea8bbbe7628d0af471c070.zip
svn merge ^/branches/released .
Diffstat (limited to 'mesalib/src/mesa/program/prog_optimize.c')
-rw-r--r--mesalib/src/mesa/program/prog_optimize.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/mesalib/src/mesa/program/prog_optimize.c b/mesalib/src/mesa/program/prog_optimize.c
index 892f5b6ec..5ffe8411c 100644
--- a/mesalib/src/mesa/program/prog_optimize.c
+++ b/mesalib/src/mesa/program/prog_optimize.c
@@ -937,24 +937,35 @@ update_interval(GLint intBegin[], GLint intEnd[],
GLuint index, GLuint ic)
{
int i;
+ GLuint begin = ic;
+ GLuint end = ic;
/* If the register is used in a loop, extend its lifetime through the end
* of the outermost loop that doesn't contain its definition.
*/
for (i = 0; i < loopStackDepth; i++) {
if (intBegin[index] < loopStack[i].Start) {
- ic = loopStack[i].End;
+ end = loopStack[i].End;
break;
}
}
+ /* Variables that are live at the end of a loop will also be live at the
+ * beginning, so an instruction inside of a loop should have its live
+ * interval begin at the start of the outermost loop.
+ */
+ if (loopStackDepth > 0 && ic > loopStack[0].Start && ic < loopStack[0].End) {
+ begin = loopStack[0].Start;
+ }
+
ASSERT(index < REG_ALLOCATE_MAX_PROGRAM_TEMPS);
if (intBegin[index] == -1) {
ASSERT(intEnd[index] == -1);
- intBegin[index] = intEnd[index] = ic;
+ intBegin[index] = begin;
+ intEnd[index] = end;
}
else {
- intEnd[index] = ic;
+ intEnd[index] = end;
}
}