Fix loading uninitialized data in loops.

When we have an uninitialized variable that is declared outside of a
loop and is read and written to inside the loop, we should not eliminate
the load and replace it with an undefined value, because in the next
iteration we want the value from the previous iteration.

Change-Id: Ic996c796307f62fc835079af6c58adf1eb288259
Reviewed-on: https://swiftshader-review.googlesource.com/8488
Tested-by: Nicolas Capens <capn@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Reactor/Optimizer.cpp b/src/Reactor/Optimizer.cpp
index ffd29bb..ca3d7a3 100644
--- a/src/Reactor/Optimizer.cpp
+++ b/src/Reactor/Optimizer.cpp
@@ -328,7 +328,10 @@
 							continue;
 						}
 
-						replace(load, storeValue);
+						if(storeValue)
+						{
+							replace(load, storeValue);
+						}
 					}
 				}
 			}