[PATCH] D16774: AMDGPU: Stop pointlessly looking at users after a bad one is found

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 09:51:05 PST 2016


arsenm created this revision.
arsenm added a reviewer: tstellarAMD.
arsenm added a subscriber: llvm-commits.
Herald added a subscriber: arsenm.

http://reviews.llvm.org/D16774

Files:
  lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp

Index: lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
===================================================================
--- lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
+++ lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
@@ -402,7 +402,10 @@
 static bool collectUsesWithPtrTypes(Value *Val, std::vector<Value*> &WorkList) {
   bool Success = true;
   for (User *User : Val->users()) {
-    if(std::find(WorkList.begin(), WorkList.end(), User) != WorkList.end())
+    if (!Success)
+      return false;
+
+    if (std::find(WorkList.begin(), WorkList.end(), User) != WorkList.end())
       continue;
     if (CallInst *CI = dyn_cast<CallInst>(User)) {
       // TODO: We might be able to handle some cases where the callee is a
@@ -429,10 +432,10 @@
       continue;
 
     WorkList.push_back(User);
-
-    Success &= collectUsesWithPtrTypes(User, WorkList);
+    Success = collectUsesWithPtrTypes(User, WorkList);
   }
-  return Success;
+
+  return true;
 }
 
 void AMDGPUPromoteAlloca::visitAlloca(AllocaInst &I) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16774.46550.patch
Type: text/x-patch
Size: 1005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160201/6f429012/attachment.bin>


More information about the llvm-commits mailing list