[all-commits] [llvm/llvm-project] edeaf4: [ConstantHoisting] Cache OptForSize. (#79170)

Alina Sbirlea via All-commits all-commits at lists.llvm.org
Tue Jan 23 09:42:59 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: edeaf41e22cc7b1ab9ef30954762f2a08a3c3561
      https://github.com/llvm/llvm-project/commit/edeaf41e22cc7b1ab9ef30954762f2a08a3c3561
  Author: Alina Sbirlea <asbirlea at google.com>
  Date:   2024-01-23 (Tue, 23 Jan 2024)

  Changed paths:
    M llvm/include/llvm/Transforms/Scalar/ConstantHoisting.h
    M llvm/lib/Transforms/Scalar/ConstantHoisting.cpp

  Log Message:
  -----------
  [ConstantHoisting] Cache OptForSize. (#79170)

CacheOptForSize to remove quadratic behavior.

For each constant analyzed, ConstantHoising calls
`shouldOptimizeForSize(F)`, which calls `PSI.getTotalCallCount(F)`.
PSI.getTotalCallCount(F) goes through all the instructions in all basic
blocks, and checks if each is a call, to count them up.

This reduces `llc` time for a very large IR from ~10min to under 3min.
Reproducer testcase is much too large to share.




More information about the All-commits mailing list