Fix loop unrolling.

Loops were no longer getting unrolled because we analyzed the entire
loop, not just the body, for changes to the index variable. Also, the
logic was inverted. Also, be conservative about loops with return
statements not being unrollable.

Bug chromium:845103

Change-Id: I5957e17f7b985ae90b10053216b6945f3f64338e
Reviewed-on: https://swiftshader-review.googlesource.com/19008
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.h b/src/OpenGL/compiler/OutputASM.h
index 1aa791e..2f90266 100644
--- a/src/OpenGL/compiler/OutputASM.h
+++ b/src/OpenGL/compiler/OutputASM.h
@@ -382,19 +382,17 @@
 	class LoopUnrollable : public TIntermTraverser
 	{
 	public:
-		bool traverse(TIntermNode *node, int loopIndexId);
+		bool traverse(TIntermLoop *loop, int loopIndexId);
 
 	private:
 		void visitSymbol(TIntermSymbol *node) override;
 		bool visitBinary(Visit visit, TIntermBinary *node) override;
 		bool visitUnary(Visit visit, TIntermUnary *node) override;
 		bool visitBranch(Visit visit, TIntermBranch *node) override;
-		bool visitLoop(Visit visit, TIntermLoop *loop) override;
 		bool visitAggregate(Visit visit, TIntermAggregate *node) override;
 
 		bool loopUnrollable;
 
-		int loopDepth;
 		int loopIndexId;
 	};
 }