[FuncSpec] Move invariant computation for spec cost out of loop (NFC-ish)
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>
Fri, 6 Aug 2021 07:38:06 +0000 (15:38 +0800)
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>
Fri, 6 Aug 2021 07:43:05 +0000 (15:43 +0800)
commitcc3f40bb41a7e818f68c9bda4457cb6776a183f3
tree5b0fa2c336370fea1e2425892e245b89c66367f9
parent4c4093e6e39fe6601f9c95a95a6bc242ef648cd5
[FuncSpec] Move invariant computation for spec cost out of loop (NFC-ish)

Noticed that the computation for function specialization cost of a
function wouldn't change during the traversal of the arguments for the
function. We could hoist the computation out of the traversal. I
observed about ~1% improvement on compile time for spec2017. But I guess
it may not be precise. This should be NFC and fine.

Reviewed By: Sjoerd Meijer

Differential Revision: https://reviews.llvm.org/D107621
llvm/lib/Transforms/IPO/FunctionSpecialization.cpp