[llvm] r262681 - CodeGen: Tune the SmallVector size in LiveRange

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 3 16:58:39 PST 2016


Author: bogner
Date: Thu Mar  3 18:58:39 2016
New Revision: 262681

URL: http://llvm.org/viewvc/llvm-project?rev=262681&view=rev
Log:
CodeGen: Tune the SmallVector size in LiveRange

The vast majority of LiveRanges (ie, 4/5) have exactly 1 segment and 1
value number, and a good chunk of the rest have 2 of each, so
allocating space for 4 is wasteful. This is especially noticeable when
dealing with a very large number of vregs, and I have an internal case
where dropping this to 2 shaves over 5% off of peak memory when
compiling a particularly large function.

Modified:
    llvm/trunk/include/llvm/CodeGen/LiveInterval.h

Modified: llvm/trunk/include/llvm/CodeGen/LiveInterval.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveInterval.h?rev=262681&r1=262680&r2=262681&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Thu Mar  3 18:58:39 2016
@@ -190,8 +190,8 @@ namespace llvm {
       void dump() const;
     };
 
-    typedef SmallVector<Segment,4> Segments;
-    typedef SmallVector<VNInfo*,4> VNInfoList;
+    typedef SmallVector<Segment, 2> Segments;
+    typedef SmallVector<VNInfo *, 2> VNInfoList;
 
     Segments segments;   // the liveness segments
     VNInfoList valnos;   // value#'s




More information about the llvm-commits mailing list