This is an archive of the discontinued LLVM Phabricator instance.

[Docs] Clarify that FunctionPasses can't add/remove declarations
ClosedPublic

Authored by aeubanks on Oct 21 2020, 8:57 AM.

Details

Summary

In preparation for potential future concurrency, a FunctionPass
shouldn't modify anything at the module level that other FunctionPasses
can also modify.

Diff Detail

Event Timeline

aeubanks created this revision.Oct 21 2020, 8:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2020, 8:57 AM
aeubanks requested review of this revision.Oct 21 2020, 8:57 AM
asbirlea accepted this revision.Oct 21 2020, 12:17 PM
This revision is now accepted and ready to land.Oct 21 2020, 12:17 PM
This revision was landed with ongoing or failed builds.Oct 22 2020, 9:04 AM
This revision was automatically updated to reflect the committed changes.
arsenm added a subscriber: arsenm.Oct 22 2020, 9:08 AM

How is this supposed to work practically? A huge number of functions passes want to add intrinsic declarations

Ideally they'd be module passes, like in https://reviews.llvm.org/D86178.
It does look like some existing legacy and NPM function passes break this rule. Maybe I should revert and ask more explicitly on llvm-dev. WDYT?

Ideally they'd be module passes, like in https://reviews.llvm.org/D86178.
It does look like some existing legacy and NPM function passes break this rule. Maybe I should revert and ask more explicitly on llvm-dev. WDYT?

I would bet the majority of passes do (e.g. InstCombine, and pretty much any target IR pass). In the past the guidance was adding declarations is OK (I thought last time this came up, this was noted somewhere in the documentation)

fhahn added a subscriber: fhahn.Oct 22 2020, 9:49 AM