[PATCH] Use Rvalue refs in APInt

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 14:28:15 PDT 2016


On Wed, Jun 1, 2016 at 9:43 AM, Pete Cooper <peter_cooper at apple.com> wrote:

> Another interesting data point is the compile time.  On my test case, SCEV::getRange is 8.9% of compile time which is a lot.  But of that, 6.3% is just in ConstantRange::multiply.  This method is heavy APInt code, and especially malloc traffic.

Yeah, that is definitely too high! Just to check: I assume you mean
8.9% of opt -O2 or something similar?

> Many of the speedup’s i’ve been finding involve doing less work (r271020 which avoids the latter half of ConstantRange::multiply and saves 3M allocations), and fixing cases of unnecessary APInt allocations (r270959).  This patch is along the same lines as the latter where we have malloc traffic we can avoid.

Making too many fixes on the APInt algorithms to avoid allocations
seems like we're solving the issue at the wrong layer.  I think fixing
infrastructural issues so that we _can_ be a little sloppy (within
reason) in extending integers without thinking too much about malloc
traffic is the right path.

But you're doing the work, so you get to decide the path forward. :)


> ConstantRange stats (bit width and count of hits in ConstantRange::ConstantRange)

This is great!  Is this a bootstrap of clang or something?

Btw, there are couple of bitwidths here that I find interesting, e.g.
I'd not have expected this many i70 ConstantRange allocations.

-- Sanjoy

> 1: 30850028
> 2: 7238
> 3: 5733
> 4: 92
> 5: 817
> 6: 294
> 7: 192
> 8: 363498
> 9: 896
> 11: 330
> 12: 378
> 13: 385
> 14: 125
> 16: 30256
> 18: 272
> 20: 98
> 24: 10
> 25: 62
> 26: 13
> 27: 181
> 28: 8
> 31: 98
> 32: 2003134
> 33: 132
> 34: 128
> 36: 76
> 38: 2130
> 41: 3
> 57: 262
> 58: 244
> 59: 342
> 60: 2418
> 61: 1211
> 62: 190
> 63: 226
> 64: 5118228
> 65: 128400
> 66: 4236
> 67: 14826
> 68: 15408
> 69: 13417
> 70: 7959
> 71: 347
> 96: 88
> 128: 364826
> 129: 379580
> 130: 19092
> 256: 4734
> 257: 19132
> 258: 71826
> 514: 4650



-- 
Sanjoy Das
http://playingwithpointers.com


More information about the llvm-commits mailing list