[all-commits] [llvm/llvm-project] e360a1: [GlobalOpt] Cache whether CC is changeable (#71381)

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Nov 7 01:37:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e360a16fee2dc3cb632ace556fb715832f488a90
      https://github.com/llvm/llvm-project/commit/e360a16fee2dc3cb632ace556fb715832f488a90
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-11-07 (Tue, 07 Nov 2023)

  Changed paths:
    M llvm/lib/Transforms/IPO/GlobalOpt.cpp

  Log Message:
  -----------
  [GlobalOpt] Cache whether CC is changeable (#71381)

The hasAddressTaken() call in hasOnlyColdCalls() has quadratic
complexity if there are many cold calls to a function: We're going to
visit each call of the function, and then for each of them iterate all
the users of the function.

We've recently encountered a case where GlobalOpt spends more than an
hour in these hasAddressTaken() checks when full LTO is used.

Avoid this by moving the hasAddressTaken() check into hasChangeableCC()
and caching its result, so it is only computed once per function.




More information about the All-commits mailing list