[Globals] Treat nobuiltin fns as maybe-derefined.
authorFlorian Hahn <flo@fhahn.com>
Tue, 23 Aug 2022 12:44:59 +0000 (13:44 +0100)
committerFlorian Hahn <flo@fhahn.com>
Tue, 23 Aug 2022 12:45:10 +0000 (13:45 +0100)
commit5913d7705618a7ccacf8207086c2bb0fc0d032a8
tree34670c069bea745c376b3dda2a63804fb66ae241
parent1e5b3ce7079af29506c0b16c0eb277a2b4781d72
[Globals] Treat nobuiltin fns as maybe-derefined.

Callsites could be marked as `builtin` while calling `nobuiltin`
functions. This can lead to problems, if local optimizations apply
transformations based on the semantics of the builtin, but then IPO
treats the function as `nobuiltin` and applies a transform that breaks
builtin semantics (assumed earlier).

To avoid this, mark such functions as maybey-derefined, to avoid IPO
transforms on them that may break assumptions of earlier calls.

Fixes #57075
Fixes #48366

Reviewed By: ychen

Differential Revision: https://reviews.llvm.org/D97735
llvm/include/llvm/IR/GlobalValue.h
llvm/lib/IR/Globals.cpp
llvm/test/Transforms/DeadArgElim/pr49022-builtin-nobuiltin.ll