[FunctionAttrs] Remove a loop, NFC refactor
authorSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 5 Nov 2015 03:04:40 +0000 (03:04 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 5 Nov 2015 03:04:40 +0000 (03:04 +0000)
commit8e56fac5c10692b0f9432f35cd3259a56da7eae0
treef1660a5a3169ed1f13419cc03b05d535fad2b635
parent76b6b15dcdfdcdeb4d6716a45e5badc99f8a5dfa
[FunctionAttrs] Remove a loop, NFC refactor

Summary:
Remove the loop over the uses of the CallSite in ArgumentUsesTracker.
Since we have the `Use *` for actual argument operand, we can just use
pointer subtraction.

The time complexity remains the same though (except for a vararg
argument) -- `std::advance` is O(UseIndex) for the ArgumentList
iterator.

The real motivation is to make a later change adding support for operand
bundles simpler.

Reviewers: reames, chandlerc, nlewycky

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@252141 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/FunctionAttrs.cpp