This is an archive of the discontinued LLVM Phabricator instance.

[MemoryBuiltins] Remove isNoAliasFn() in favor of isNoAliasCall()
ClosedPublic

Authored by nikic on Jan 7 2022, 1:18 AM.

Details

Summary

We currently have two similar implementations of this concept: isNoAliasCall() only checks for the noalias return attribute. isNoAliasFn() also checks for allocation functions.

We should switch to only checking the attribute. SLC is responsible for inferring the noalias return attribute for non-new allocation functions (with a missing case fixed in https://github.com/llvm/llvm-project/commit/348bc76e3548c52dbcd442590ca0a7f5b09b7534). For new, clang is responsible for setting the attribute, if -fno-assume-sane-operator-new is not passed.

Diff Detail

Event Timeline

nikic created this revision.Jan 7 2022, 1:18 AM
nikic requested review of this revision.Jan 7 2022, 1:18 AM
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
nikic added inline comments.Jan 7 2022, 1:19 AM
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
5279

This check is already performed within getInitialValueForObj(), I figured we may as well not duplicate the logic.

bmahjour removed a subscriber: bmahjour.Jan 7 2022, 6:42 AM

I like this, anyone else?

llvm/lib/Transforms/IPO/AttributorAttributes.cpp
5279

Agreed.

fhahn accepted this revision.Jan 7 2022, 8:12 AM

LGTM, thanks!

This revision is now accepted and ready to land.Jan 7 2022, 8:12 AM
reames accepted this revision.Jan 7 2022, 8:35 AM

LGTM as well.

(You'll have to rebase over a couple of my commits from last night, but should be straightforward. Trying to cleanup this interface as much as possible so we can tell what properties of allocator routines we actually care about.)

This revision was landed with ongoing or failed builds.Jan 10 2022, 12:18 AM
This revision was automatically updated to reflect the committed changes.