[all-commits] [llvm/llvm-project] 2453da: [CodeGenPrepare] Fix counting uses when folding ad...

Momchil Velikov via All-commits all-commits at lists.llvm.org
Thu Mar 30 06:18:46 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2453da0a4e606c8dc75ed9cae0534b0c87ba77b9
      https://github.com/llvm/llvm-project/commit/2453da0a4e606c8dc75ed9cae0534b0c87ba77b9
  Author: Momchil Velikov <momchil.velikov at arm.com>
  Date:   2023-03-30 (Thu, 30 Mar 2023)

  Changed paths:
    M llvm/lib/CodeGen/CodeGenPrepare.cpp
    M llvm/test/CodeGen/Generic/addr-use-count.ll

  Log Message:
  -----------
  [CodeGenPrepare] Fix counting uses when folding addresses into memory instructions

The counter of the number of instructions seen in `FindAllMemoryUses`
is reset after returning from a recursive invocation of
`FindAllMemoryUses` to the value it had before the call. In effect,
depending on the shape of the uses graph, the function may scan up to
`2^N-1` instructions where `N` is the scan limit
(`MaxMemoryUsesToScan`).  This does not look intuitive or intended.

This patch changes the counting to just count the scanned
instructions, independent of the shape of the references.

Reviewed By: mkazantsev

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

Change-Id: I99f5de55e84843cf2fbea287d6ae4312fa196240




More information about the All-commits mailing list