[CallGraph][FIX] Ensure generic intrinsics are represented in the CG
authorJohannes Doerfert <johannes@jdoerfert.de>
Sat, 7 Jan 2023 09:00:14 +0000 (01:00 -0800)
committerJohannes Doerfert <johannes@jdoerfert.de>
Tue, 10 Jan 2023 19:38:58 +0000 (11:38 -0800)
commit10410534696e1922cbed56b229d123b2db4acd8e
treedb6aba40d34e6131b5b83ae0c7e8f652c3e00910
parentf6ce39cf1d1d80699e13cd1422f60d428e5cf0ec
[CallGraph][FIX] Ensure generic intrinsics are represented in the CG

Intrinsics have historically been excluded from the call graph with an
exception of 3 special ones added at some point. This meant that passes
depending on the call graph needed to handle intrinsics explicitly as
the underlying assumption, namely that intrinsics can't call or modify
things, doesn't hold. We are slowly moving away from special handling of
intrinsics, or at least towards explicitly checking what intrinsics we
want to handle differently.

This patch:
 - Includes most intrinsics in the call graph. Debug intrinsics are
   still excluded.
 - Removes the special handling of intrinsics in the GlobalsAA pass.
 - Removes the `IntrinsicInst::isLeaf` method.

Properly
Fixes: https://github.com/llvm/llvm-project/issues/52706

See also:
https://discourse.llvm.org/t/intrinsics-are-not-special-stop-pretending-i-mean-it/67545

Differential Revision: https://reviews.llvm.org/D14119
llvm/include/llvm/Analysis/CallGraph.h
llvm/include/llvm/IR/Intrinsics.h
llvm/lib/Analysis/CallGraph.cpp
llvm/lib/Analysis/CallGraphSCCPass.cpp
llvm/lib/Analysis/GlobalsModRef.cpp
llvm/lib/IR/Function.cpp
llvm/test/Analysis/CallGraph/ignore-assumelike-calls.ll
llvm/test/Analysis/CallGraph/non-leaf-intrinsics.ll
llvm/test/Transforms/GVN/intrinsics_in_cg.ll