Giter Site home page Giter Site logo

Comments (6)

ChuanqiXu9 avatar ChuanqiXu9 commented on August 21, 2024 2

Sent #638

BTW, when I test it with a real world project (https://github.com/alibaba/async_simple), I met some crashes when generating the CIR. I'd like to work on it.

from clangir.

Lancern avatar Lancern commented on August 21, 2024

Hi Chuanqi. This should be a first-class use case of clangir. You can pass -emit-cir switch to clang_cc1 to emit CIR only and avoid the CIR -> MLIR/LLVMIR part. Along the way one may still run any analysis passes and CIR -> CIR transformation passes.

clangir already has a PoC implementation of a lifetime checker, which can be found at https://github.com/llvm/clangir/blob/main/clang/lib/CIR/Dialect/Transforms/LifetimeCheck.cpp (but for now it might be a bit out-of-date). One can run this analysis pass via:

clang++ -cc1 -fclangir -emit-cir -fclangir-lifetime-check -o output.cir input.cpp

I like your idea about an "analysis-only" pipeline. The problem with the above pipeline is that it still run some passes that are required for CIR -> MLIR/LLVMIR but are not required for an analysis-only pipeline (LoweringPrepare is a typical one).

from clangir.

ChuanqiXu9 avatar ChuanqiXu9 commented on August 21, 2024

Hi,

the interface looks like not the one I want.

What I want is:

clang++ input.cpp -fenable-cir-check -c -o input.o

That is, it is just normal compilation except we add some new analysis. If we can do this, it is much easier to enable CIR for real world users.

from clangir.

bcardosolopes avatar bcardosolopes commented on August 21, 2024

Hi @ChuanqiXu9, thanks for clarifying your question.

Right now, if you use -fclangir you're not going to get what you want, because it will enable CIR for codegen as well, as you probably noticed, hence this issue. I guess at some point we could have a -fclangir-analysis-only or something like that to do what you are asking for.

We don't have anything like that right now because none of our users have that usecase, and we avoid adding things that there are no uses for, but nothing prevents it being added at some point. It'd be useful for instance when running the lifetime checker without changing the existing codegen path.

To summarize: we have no plans or intention to change -fclangir meaning, but it would be totally fine to add something like a -fclangir-analysis-only (btw, it's a rather simple change to do that).

from clangir.

ChuanqiXu9 avatar ChuanqiXu9 commented on August 21, 2024

Hi @ChuanqiXu9, thanks for clarifying your question.

Right now, if you use -fclangir you're not going to get what you want, because it will enable CIR for codegen as well, as you probably noticed, hence this issue. I guess at some point we could have a -fclangir-analysis-only or something like that to do what you are asking for.

We don't have anything like that right now because none of our users have that usecase, and we avoid adding things that there are no uses for, but nothing prevents it being added at some point. It'd be useful for instance when running the lifetime checker without changing the existing codegen path.

To summarize: we have no plans or intention to change -fclangir meaning, but it would be totally fine to add something like a -fclangir-analysis-only (btw, it's a rather simple change to do that).

Fair enough summary. I'd like to see if I can make a simple patch.

from clangir.

bcardosolopes avatar bcardosolopes commented on August 21, 2024

@ChuanqiXu9 thanks the PR, will take a look soon. I bet it crashes cause we still have lots of C++ stuff to support, but being able to build async_simple would be really cool, looking forward to see your contributions

from clangir.

Related Issues (20)

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.