OSDN Git Service

Don't generate unnecessary signed ConstantRange during multiply. NFC
authorPete Cooper <peter_cooper@apple.com>
Fri, 27 May 2016 17:06:50 +0000 (17:06 +0000)
committerPete Cooper <peter_cooper@apple.com>
Fri, 27 May 2016 17:06:50 +0000 (17:06 +0000)
commit90a2421c29a8513a61b4e6672989a91a596b394c
tree211c2e736ef2396bf55658a693d192f1462e7e59
parent5b363367fefdb82034673bdcc57e9f71628a11c1
Don't generate unnecessary signed ConstantRange during multiply.  NFC

r231483 taught ConstantRange::multiply to be clever about signed vs unsigned ranges. For example, an unsigned range could be full-set while the signed range is more specific than that.

In looking at the allocations trace for LTO'ing verify-uselistorder (see r236629 for details), millions of allocations are from APInt, many of which come from ConstantRange's.

This change tries to avoid some (3.2 million) allocations by returning the unsigned range if its suitable. The checks here are that it should not be a wrapping range, and should be positive. That should be enough to check for ranges such as [1, 10) which the signed range will be equal to, if we were to calculate it.

Differential Revision: http://reviews.llvm.org/D20723

Reviewed by James Molloy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271020 91177308-0d34-0410-b5e6-96231b3b80d8
lib/IR/ConstantRange.cpp