Coder Social home page Coder Social logo

wg-codegen's People

Contributors

nox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wg-codegen's Issues

Optimize redundant memory accesses in MIR?

Under "Design new MIR-level optimisations", one of the big questions is what kinds of optimizations can be done on MIR. Inlining, constant folding, and expression simplification are obvious candidates.

But if we could rely on Rust's aliasing, and immutable lets, we could also do basic GVN, LICM, DSE, and others, with relatively little analysis. It wouldn't be a replacement for full SSA and sophisticated analysis (such as LLVM does), but it might be a low-cost way to reduce the amount of code sent to LLVM, and the amount of work LLVM has to do.

To be effective, this needs to work in the presence of unsafe, or any call which could use unsafe. I'm aware that the rules for unsafe are still in development, but would it be possible to assume that this:

pub fn foo(x: &i32, data: &mut [i32]) {
    for e in data {
        unsafe { /* do your worst, but no UB */ }
        *e += *x;         // <------ load inside the loop
    }
}

is equivalent to this?

pub fn foo(x: &i32, data: &mut [i32]) {
    let y = *x;        // <------ load outside the loop
    for e in data {
        unsafe { /* do your worst, but no UB */ }
        *e += y;
    }
}

If we could do this, then we could do a bunch of other things too.

Join Cretonne and the codegen working group

Hi @nox and @sunfishcode,

I have raised this issue to discuss the possibility of the codegen working group focusing primarily on the development of cretonne. I hope my reasoning for doing so and ideas about what the working group could do are helpful.


I think the codegen working group's main goal should be the development of the cretonne code generator. The cretonne code generator is primarily written in Rust and a goal for the project is to be a a full optimizing release-capable backend. Putting cretonne in front of the LLVM goals could help make the Rust compiler be written entirely in Rust. I am assuming that people who want to make the Rust compiler faster will want to write Rust instead of C++. Cretonne also seems to be more contributor friendly for Rustaceans of all skill levels LLVM.

Ideas about how the working group could help cretonne

  • A website similar to llvm.org to be the central hub (cretonne-lang.org is available)
  • Work to get sponsors to fund the development of cretonne
    • Work to get computer science researchers and students to help develop cretonne
  • Make a team or teams similar to the Rust teams could help structure the development of cretonne

Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.