[Statepoint] Use default attributes for some GC intrinsics
authorNikita Popov <npopov@redhat.com>
Fri, 28 Oct 2022 09:21:30 +0000 (11:21 +0200)
committerNikita Popov <npopov@redhat.com>
Tue, 8 Nov 2022 08:27:22 +0000 (09:27 +0100)
commit3ddf56fd37b863bd778a63339e7c1ad9eca789d9
tree3b794e8b8846425b1b094511846f8447f49416dd
parent3705e038e4eb7514368024b0d70047bd4cecfc73
[Statepoint] Use default attributes for some GC intrinsics

This adds the default intrinsic attributes (nosync, nofree, nocallback,
willreturn) to the gc.result, gc.relocate, gc.pointer.base and
gc.pointer.offset intrinsics. As far as I understand, all of these
are supposed to be pure. Some quotes from LangRef:

> A gc.result is modeled as a ‘readnone’ pure function. It has no
> side effects since it is just a projection of the return value of
> the previous call represented by the gc.statepoint.

> A gc.relocate is modeled as a readnone pure function. It has no
> side effects since it is just a way to extract information about
> work done during the actual call modeled by the gc.statepoint.

Having willreturn in particular will be important to avoid
optimization regressions in the future.

Differential Revision: https://reviews.llvm.org/D136929
llvm/include/llvm/IR/Intrinsics.td
llvm/test/Transforms/RewriteStatepointsForGC/statepoint-attrs.ll