Comments (6)
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.
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.
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.
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.
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.
@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)
- Crash with try statement HOT 1
- [GSoC] Add OpenCL support to compile GPU kernels
- Reinstate #668 and #678 HOT 2
- Verify ZdlPv -> ZdlPvm in `test/CIR/CodeGen/dtors.cpp`
- Verify gep uses moving to i64
- Replace uses of `isa`/`dyn_cast`/`cast`/... member functions HOT 2
- Data layout modeling for CIR types
- Add support for `__atomic_thread_fence` HOT 3
- Add canonicalization passes for cir.complex.create
- Problem with emitting MLIR from CIR: `cir.func` gets `dsolocal` attribute HOT 4
- Non-constant memory order in atomic built-ins HOT 3
- Keep higher level abstraction for runtime memory orders on atomics
- `emit-cir-flat` is a bit broken HOT 2
- Teach op parsers to use enum keyword parsing helpers
- Does CIR support CUDA? HOT 2
- higher level representation for initlist
- Add ternary select op and (maybe) binary boolean op HOT 2
- Debug info should not be emitted when `-g` is not specified
- assign new expr result to const global variant cause crash
- functional call with `byval`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clangir.