OSDN Git Service

Memory leak fix nougat-x86 oreo-x86 android-x86-7.1-r3 android-x86-7.1-r4 android-x86-7.1-r5 android-x86-8.1-r1 android-x86-8.1-r2 android-x86-8.1-r3 android-x86-8.1-r4 android-x86-8.1-r5 android-x86-8.1-r6
authorAlexis Hetu <sugoi@google.com>
Fri, 22 Jun 2018 20:02:55 +0000 (16:02 -0400)
committerNicolas Capens <nicolascapens@google.com>
Fri, 22 Jun 2018 20:08:13 +0000 (20:08 +0000)
Early returns were erroneous and were causing memory leaks

Change-Id: Ifd6e37d79b6abd3f7d8d8899c951f1a0b4a66fb0
Reviewed-on: https://swiftshader-review.googlesource.com/19588
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
src/Reactor/Optimizer.cpp

index 15c5f84..aac8c04 100644 (file)
@@ -150,14 +150,14 @@ namespace
 
                        if(!llvm::isa<Ice::InstAlloca>(alloca))
                        {
-                               return;   // Allocas are all at the top
+                               break;   // Allocas are all at the top
                        }
 
                        Ice::Operand *address = alloca.getDest();
 
                        if(!hasUses(address))
                        {
-                               return;
+                               continue;
                        }
 
                        const auto &addressUses = *getUses(address);
@@ -213,14 +213,14 @@ namespace
 
                        if(!llvm::isa<Ice::InstAlloca>(alloca))
                        {
-                               return;   // Allocas are all at the top
+                               break;   // Allocas are all at the top
                        }
 
                        Ice::Operand *address = alloca.getDest();
 
                        if(!hasUses(address))
                        {
-                               return;
+                               continue;
                        }
 
                        auto &addressUses = *getUses(address);
@@ -324,14 +324,14 @@ namespace
 
                        if(!llvm::isa<Ice::InstAlloca>(alloca))
                        {
-                               return;   // Allocas are all at the top
+                               break;   // Allocas are all at the top
                        }
 
                        Ice::Operand *address = alloca.getDest();
 
                        if(!hasUses(address))
                        {
-                               return;
+                               continue;
                        }
 
                        const auto &addressUses = *getUses(address);