-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
effects: add :inaccessiblememonly
effect
#46198
Conversation
base/expr.jl
Outdated
@@ -570,6 +571,19 @@ moved between tasks without observable results. | |||
code that is not `:notaskstate`, but is `:effect_free` and `:consistent` | |||
may still be dead-code-eliminated and thus promoted to `:total`. | |||
|
|||
--- | |||
## `:noglobal` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the same as inaccessiblemem_or_argmemonly
in llvm? Asking because at some point it would be useful to start transferring our annotations into LLVM too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's quite the same, since this excludes the case where you're passing in a global as an argument. I think :noglobal
probably implies it though?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently :noglobal === true
means inaccessiblemem_or_argmemonly
and it includes cases we access to (potentially) global memory passed as an argument. And we additionally check that arguments are never be mutable global memory (by a simple type analysis) when trying to refine :consistent
or :effect_free
information later.
Now I wonder if we should make :noglobal === ALWAYS_TRUE
mean inaccessiblemem
and :noglobal === INACCESSIBLEMEM_OR_ARGMEMONLY
mean that so.
And I guess one more difference is that :noglobal
doesn't really reason about immutable global memory, as it doesn't taint :consistent
-cy/:effect_free
-ness anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking about this for a bit, now I think it's a bit confusing that currently :noglobal === ALWAYS_TRUE
doesn't exclude access to arguments memory, and we may want to make :noglobal === ALWAYS_TRUE
mean inaccessiblemem
and :noglobal === ARGMEM
mean inaccessiblemem_or_argmemonly
and also rename :noglobal
to :inaccessiblemem
.
This property may not necessarily 1-to-1 correspond to LLVM's function attributes since our :inaccessiblemem
only reasons about mutable memory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
llvm also only reasons about mutable memory
393a818
to
63ba3dc
Compare
d64d832
to
b1f1f49
Compare
:noglobal
effect:inaccessiblememonly
effect
This is a preparatory PR for future improvements on the effects analysis. This commit adds the `:inaccessiblememonly` helper effect, that tracks if a method involves any access or modification on any mutable state. This effect property is basically same as LLVM's `inaccessiblememonly` function attribute, except that it only reasons about mutable memory. This effect property can be considered as a very limited and coarse version of escape analysis and allow us prove `:consistent`-cy or `:effect_free`-ness even in a presence of accesses or modifications on local mutable allocations in cases when we can prove they are local and don't escape. Separate PRs that actually improve the effect analysis accuracy will follow.
This is a preparatory PR for future improvements on the effects analysis. This commit adds the `:inaccessiblememonly` helper effect, that tracks if a method involves any access or modification on any mutable state. This effect property is basically same as LLVM's `inaccessiblememonly` function attribute, except that it only reasons about mutable memory. This effect property can be considered as a very limited and coarse version of escape analysis and allow us prove `:consistent`-cy or `:effect_free`-ness even in a presence of accesses or modifications on local mutable allocations in cases when we can prove they are local and don't escape. Separate PRs that actually improve the effect analysis accuracy will follow.
This is a preparatory PR for future improvements on the effects analysis. This commit adds the `:inaccessiblememonly` helper effect, that tracks if a method involves any access or modification on any mutable state. This effect property is basically same as LLVM's `inaccessiblememonly` function attribute, except that it only reasons about mutable memory. This effect property can be considered as a very limited and coarse version of escape analysis and allow us prove `:consistent`-cy or `:effect_free`-ness even in a presence of accesses or modifications on local mutable allocations in cases when we can prove they are local and don't escape. Separate PRs that actually improve the effect analysis accuracy will follow.
This is a preparatory PR for future improvements on the effects analysis.
This commit adds the
:inaccessiblememonly
helper effect, that tracksif a method involves any access or modification on any mutable state.
This effect property is basically same as LLVM's
inaccessiblememonly
function attribute, except that it only reasons about mutable memory.
This effect property can be considered as a very limited and coarse
version of escape analysis and allow us prove
:consistent
-cy or:effect_free
-ness even in a presence of accesses or modificationson local mutable allocations in cases when we can prove they are local
and don't escape. Separate PRs that actually improve the effect analysis
accuracy will follow.