effekt-lang / effekt-lang/effekt

Investigate using memory use markers in the generated LLVM

Open
#516 0 comments 3 reactions 0 assignees View on GitHub
area:llvm feature
Dominant language
Scala
Stars
469
Forks
41
Avg merge
1d 16h
Merged PRs (30d)
23

Description

LLVM has intrinsics like `llvm.lifetime.start` and `llvm.lifetime.end` which are used for explicitly specifying a stack object's lifetime. If we use it, the LLVM `opt` tool might figure out more of our invariants regarding stack-allocated objects and might be able to optimise them better. (For example, decide to let two non-intersecting variables share the same chunk of stack space.)

Here's the reference: https://llvm.org/docs/LangRef.html#memory-use-markers

The changes would be applied at every `alloca`, so at the very least in the `case machine.Allocate` of the `transform` function (as far as I can tell, the lifetime is after extracting the local reference & before the terminator), and in the push-/popEnvironment functions. We should also be able to use `llvm.invariant` intrinsics to specify that a piece of memory won't change.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.