[Attributor] Lazily collect function information
authorJohannes Doerfert <johannes@jdoerfert.de>
Sat, 11 Apr 2020 17:37:09 +0000 (12:37 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Thu, 16 Apr 2020 03:26:38 +0000 (22:26 -0500)
commit898bbc252a72b950cae138c3cad1e0ec4e17c902
tree49579d1eec1595cc3517f45782101aca62fc8849
parent8c4057e3a35dfab77c0fafc307980124f2b07b5e
[Attributor] Lazily collect function information

Before, we eagerly analyzed all the functions to collect information
about them, e.g. what instructions may read/write memory. This had
multiple drawbacks:
  - In CGSCC-mode we can end up looking at a callee which is not in the
    SCC but for which we need an initialized cache.
  - We end up looking at functions that we deem dead and never need to
    analyze in the first place.
  - We have a implicit dependence which is easy to break.

This patch moves the function analysis into the information cache and
makes it lazy. There is no real functional change expected except due to
the first reason above.
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp