From: Sanjoy Das Date: Tue, 20 Oct 2015 01:06:31 +0000 (+0000) Subject: [RS4GC] Remove a redundant linear search, NFCI X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=35072eb786d5f1188973fd3180559b50fde9f274;p=oota-llvm.git [RS4GC] Remove a redundant linear search, NFCI Since LiveVariables is uniqued (we just created it from a `DenseSet`), `FindIndex(LiveVariables, LiveVariables[i])` is always `i`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250786 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp b/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp index 2001b071f78..6be71dc3d94 100644 --- a/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp +++ b/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp @@ -1342,8 +1342,7 @@ static void CreateGCRelocates(ArrayRef LiveVariables, // Generate the gc.relocate call and save the result Value *BaseIdx = Builder.getInt32(LiveStart + FindIndex(LiveVariables, BasePtrs[i])); - Value *LiveIdx = - Builder.getInt32(LiveStart + FindIndex(LiveVariables, LiveVariables[i])); + Value *LiveIdx = Builder.getInt32(LiveStart + i); // only specify a debug name if we can give a useful one CallInst *Reloc = Builder.CreateCall(