Repository navigation
Conversation
deca8d3 to
a9aedb3
Compare
|
LLVM didn't really like speculatable coming there, I will need to think this a bit more through. |
a9aedb3 to
e1383f3
Compare
| #if JL_LLVM_VERSION >= 140000 | ||
| AttrBuilder attr(C); | ||
| #else | ||
| AttrBuilder attr; |
There was a problem hiding this comment.
Perhaps we could prefix all of the custom string attributes with julia. to avoid any namespace collisions
There was a problem hiding this comment.
Yeah, they are there mostly for debugging, we probably want a smarter way to encode this
| attr.addAttribute("nothrow"); | ||
| attr.addAttribute(Attribute::NoUnwind); // Is this even correct, because nothrow allows for try/catch | ||
| } | ||
| if (terminates == 1){ |
There was a problem hiding this comment.
Add mustprogress here too?
There was a problem hiding this comment.
willreturn already implies mustprogress but I guess it's fine adding both
| if (nonoverlayed == 1) | ||
| attr.addAttribute("nonoverlayed"); |
There was a problem hiding this comment.
Well do you have some idea to use this attribute? It's very Julia-compiler specific attribute.
There was a problem hiding this comment.
Not really, I just wanted to see if I was getting all the effects correctly at the LLVM level, those string like attributes were just for debugging.
2a4f204 to
eb13558
Compare
eb13558 to
4b80689
Compare
) Translate Julia's inferred effects (consistent, effect_free, nothrow, terminates, notaskstate) into LLVM function attributes so that middle-end passes like GVN, LICM, and DSE can exploit them. The key design insight is that GC interactions don't need to be visible before GC lowering. Call-site declarations get optimistic memory attributes (e.g. memory(argmem: read)) that enable pre-GC optimizations, then LateLowerGCFrame widens them to memory(readwrite) before safepoint analysis so post-GC passes see correct semantics. Attributes added: - nounwind: for nothrow functions (with uwtable(async) on definitions to preserve .eh_frame for stack scanning) - mustprogress: for terminating functions - willreturn: for nothrow+terminating functions - memory(argmem: read): for consistent+effect_free functions with no user-facing pointer arguments (call-site declarations only) - readnone on gcstack param: for notaskstate functions, so LICM can hoist pure calls past heap stores - "julia.safepoint" marker: on all call-site declarations, used by LateLowerGCFrame to identify and widen optimistic attrs LateLowerGCFrame strips all optimistic attributes (memory effects, readnone on gcstack) from both call instructions and function declarations before safepoint analysis runs. Previously explored in #47844 Developed with Claude --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Gabriel Baraldi <28694980+gbaraldi@users.noreply.github.com>
…iaLang#61394) Translate Julia's inferred effects (consistent, effect_free, nothrow, terminates, notaskstate) into LLVM function attributes so that middle-end passes like GVN, LICM, and DSE can exploit them. The key design insight is that GC interactions don't need to be visible before GC lowering. Call-site declarations get optimistic memory attributes (e.g. memory(argmem: read)) that enable pre-GC optimizations, then LateLowerGCFrame widens them to memory(readwrite) before safepoint analysis so post-GC passes see correct semantics. Attributes added: - nounwind: for nothrow functions (with uwtable(async) on definitions to preserve .eh_frame for stack scanning) - mustprogress: for terminating functions - willreturn: for nothrow+terminating functions - memory(argmem: read): for consistent+effect_free functions with no user-facing pointer arguments (call-site declarations only) - readnone on gcstack param: for notaskstate functions, so LICM can hoist pure calls past heap stores - "julia.safepoint" marker: on all call-site declarations, used by LateLowerGCFrame to identify and widen optimistic attrs LateLowerGCFrame strips all optimistic attributes (memory effects, readnone on gcstack) from both call instructions and function declarations before safepoint analysis runs. Previously explored in JuliaLang#47844 Developed with Claude --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Gabriel Baraldi <28694980+gbaraldi@users.noreply.github.com>
…iaLang#61394) Translate Julia's inferred effects (consistent, effect_free, nothrow, terminates, notaskstate) into LLVM function attributes so that middle-end passes like GVN, LICM, and DSE can exploit them. The key design insight is that GC interactions don't need to be visible before GC lowering. Call-site declarations get optimistic memory attributes (e.g. memory(argmem: read)) that enable pre-GC optimizations, then LateLowerGCFrame widens them to memory(readwrite) before safepoint analysis so post-GC passes see correct semantics. Attributes added: - nounwind: for nothrow functions (with uwtable(async) on definitions to preserve .eh_frame for stack scanning) - mustprogress: for terminating functions - willreturn: for nothrow+terminating functions - memory(argmem: read): for consistent+effect_free functions with no user-facing pointer arguments (call-site declarations only) - readnone on gcstack param: for notaskstate functions, so LICM can hoist pure calls past heap stores - "julia.safepoint" marker: on all call-site declarations, used by LateLowerGCFrame to identify and widen optimistic attrs LateLowerGCFrame strips all optimistic attributes (memory effects, readnone on gcstack) from both call instructions and function declarations before safepoint analysis runs. Previously explored in JuliaLang#47844 Developed with Claude --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Gabriel Baraldi <28694980+gbaraldi@users.noreply.github.com>
|
I suppose this was superseded by #61394 ? |
|
Yes. |
I'm not sure about the correctness of this. Basically playing with it and asking for help.
This is very similar to what #32368 wanted to do