]> granicus.if.org Git - llvm/commit
[LazyValueInfo] Avoid unnecessary copies of ConstantRanges
authorCraig Topper <craig.topper@gmail.com>
Sat, 6 May 2017 03:35:15 +0000 (03:35 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sat, 6 May 2017 03:35:15 +0000 (03:35 +0000)
commit583a25140f30251a26ecb65e492084b6b773ffcc
treea6d315576d2b23a86ecc62ced2fb060e1eee1880
parent3ff0533844036c79e49b0b0d8270aa87cd724c9f
[LazyValueInfo] Avoid unnecessary copies of ConstantRanges

Summary:
ConstantRange contains two APInts which can allocate memory if their width is larger than 64-bits. So we shouldn't copy it when we can avoid it.

This changes LVILatticeVal::getConstantRange() to return its internal ConstantRange by reference. This allows many places that just need a ConstantRange reference to avoid making a copy.

Several places now capture the return value of getConstantRange() by reference so they can call methods on it that don't need a new object.

Lastly it adds std::move in one place to capture to move a local ConstantRange into an LVILatticeVal.

Reviewers: reames, dberlin, sanjoy, anna

Reviewed By: reames

Subscribers: grandinj, llvm-commits

Differential Revision: https://reviews.llvm.org/D32884

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302331 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Analysis/LazyValueInfo.cpp