This is an archive of the discontinued LLVM Phabricator instance.

[CGCall] Annotate operator new with inaccessiblememonly if AssumeSaneOperatorNew is on
Needs ReviewPublic

Authored by Bryce-MW on Jan 18 2022, 1:26 PM.

Details

Reviewers
reames
rsmith
Summary

Basic Alias Analysis in LLVM currently has a special case for allocation functions (including operator new) that essentially assumes that they are inaccessiblememonly. Operator new is not currently annotated with inaccessiblememonly because that is not technically correct (especially considering global replacement functions). This patch allows that case to be removed (D117180) allowing operator new to be correct when needed without causing the significant regression that we found when removing the special case).

Diff Detail

Event Timeline

Bryce-MW created this revision.Jan 18 2022, 1:26 PM
Bryce-MW edited the summary of this revision. (Show Details)Jan 18 2022, 1:39 PM
Bryce-MW retitled this revision from [CGCall] Annotate op new with inaccessiblememonly if AssumeSaneOperatorNew is on to [CGCall] Annotate operator new with inaccessiblememonly if AssumeSaneOperatorNew is on.Jan 18 2022, 2:54 PM
Bryce-MW edited the summary of this revision. (Show Details)
Bryce-MW updated this revision to Diff 401006.Jan 18 2022, 3:03 PM
  • Add change to docs
Bryce-MW published this revision for review.Jan 18 2022, 3:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 18 2022, 3:04 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
nikic added a subscriber: nikic.Jan 24 2022, 12:48 AM
nikic added inline comments.
clang/lib/CodeGen/CGCall.cpp
2071

This should be Attribute::InacccessibleMemOnly. It's not a string attribute.

Bryce-MW updated this revision to Diff 403339.Jan 26 2022, 10:58 AM
Bryce-MW marked an inline comment as done.
  • Use proper attribute
clang/lib/CodeGen/CGCall.cpp
2071

Thanks, I tried to look for a list but I didn't have any luck (and my IDE was having trouble loading the CMake project so I couldn't jump to definition on another attribute).