[llvm] r250786 - [RS4GC] Remove a redundant linear search, NFCI

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 18:06:31 PDT 2015


Author: sanjoy
Date: Mon Oct 19 20:06:31 2015
New Revision: 250786

URL: http://llvm.org/viewvc/llvm-project?rev=250786&view=rev
Log:
[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`.

Modified:
    llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp?rev=250786&r1=250785&r2=250786&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp Mon Oct 19 20:06:31 2015
@@ -1342,8 +1342,7 @@ static void CreateGCRelocates(ArrayRef<V
     // 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(




More information about the llvm-commits mailing list