Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR][Pipeline] Support -fclangir-analysis-only #638

Merged
merged 5 commits into from
Jun 3, 2024

Conversation

ChuanqiXu9
Copy link
Member

@ChuanqiXu9 ChuanqiXu9 commented May 29, 2024

Close #633.

This patch introduces -fclangir-analysis-only option to allow the users to consume the AST to the CIR (and potential analysis passes, this can be done by specifying -Xclang -fclangir-lifetime-check="" now or some default value in following patches) and also generating the LLVM IR by the traditional code gen path. This will be helpful to use CIR with real world projects without worrying the correctness and completeness of CIR CodeGen part.

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, discussion comments inline

clang/include/clang/Driver/Options.td Outdated Show resolved Hide resolved
clang/lib/CodeGen/CMakeLists.txt Outdated Show resolved Hide resolved
clang/lib/CodeGen/CodeGenAction.cpp Show resolved Hide resolved
clang/lib/CodeGen/CodeGenAction.cpp Outdated Show resolved Hide resolved
clang/include/clang/Driver/Options.td Outdated Show resolved Hide resolved
clang/include/clang/Frontend/FrontendOptions.h Outdated Show resolved Hide resolved
clang/lib/Driver/ToolChains/Clang.cpp Show resolved Hide resolved
Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit remaining but otherwise LGTM

clang/include/clang/Driver/Options.td Outdated Show resolved Hide resolved
clang/lib/Driver/ToolChains/Clang.cpp Show resolved Hide resolved
@bcardosolopes bcardosolopes changed the title [CIR] [Pipeline] Support -fclangir-analysis-only [CIR][Pipeline] Support -fclangir-analysis-only May 30, 2024
@ChuanqiXu9
Copy link
Member Author

It shows it has conflicts but I just rebased to main

Copy link
Member

@bcardosolopes bcardosolopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bcardosolopes
Copy link
Member

I'll merge as soon as the conflicts are fixed.

It shows it has conflicts but I just rebased to main

It conflicts with something that landed more or less about the time you updated, shall work if you do it again.

@ChuanqiXu9
Copy link
Member Author

Done

@bcardosolopes bcardosolopes merged commit f4d538f into llvm:main Jun 3, 2024
6 checks passed
bcardosolopes added a commit that referenced this pull request Jun 6, 2024
This reverts commit f4d538f.

It's causing a circular dependency in shared lib builds. See #655
bcardosolopes pushed a commit that referenced this pull request Sep 18, 2024
Reland #638

This was reverted due to #655. I
tried to address the problem in the newest commit.

The changes of the PR since the last landed one includes:
- Move the definition of `cir::CIRGenConsumer` to
`clang/include/clang/CIRFrontendAction/CIRGenConsumer.h`, and leave its
`HandleTranslationUnit` interface is left empty. So that
`cir::CIRGenConsumer` won't need to depend on CodeGen any more.
- Change the old definition of `cir::CIRGenConsumer` in
`clang/lib/CIR/FrontendAction/CIRGenAction.cpp` and to
`CIRLoweringConsumer`, inherited from `cir::CIRGenConsumer`, which
implements the original `HandleTranslationUnit` interface.

I feel this may improve the readability more even without my original
patch.
bruteforceboy pushed a commit to bruteforceboy/clangir that referenced this pull request Oct 2, 2024
Close llvm#633.

This patch introduces `-fclangir-analysis-only` option to allow the
users to consume the AST to the CIR (and potential analysis passes, this
can be done by specifying `-Xclang -fclangir-lifetime-check=""` now or
some default value in following patches) and also generating the LLVM IR
by the traditional code gen path. This will be helpful to use CIR with
real world projects without worrying the correctness and completeness of
CIR CodeGen part.
bruteforceboy pushed a commit to bruteforceboy/clangir that referenced this pull request Oct 2, 2024
This reverts commit f4d538f.

It's causing a circular dependency in shared lib builds. See llvm#655
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
Close llvm#633.

This patch introduces `-fclangir-analysis-only` option to allow the
users to consume the AST to the CIR (and potential analysis passes, this
can be done by specifying `-Xclang -fclangir-lifetime-check=""` now or
some default value in following patches) and also generating the LLVM IR
by the traditional code gen path. This will be helpful to use CIR with
real world projects without worrying the correctness and completeness of
CIR CodeGen part.
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
This reverts commit f4d538f.

It's causing a circular dependency in shared lib builds. See llvm#655
Hugobros3 pushed a commit to shady-gang/clangir that referenced this pull request Oct 2, 2024
Reland llvm#638

This was reverted due to llvm#655. I
tried to address the problem in the newest commit.

The changes of the PR since the last landed one includes:
- Move the definition of `cir::CIRGenConsumer` to
`clang/include/clang/CIRFrontendAction/CIRGenConsumer.h`, and leave its
`HandleTranslationUnit` interface is left empty. So that
`cir::CIRGenConsumer` won't need to depend on CodeGen any more.
- Change the old definition of `cir::CIRGenConsumer` in
`clang/lib/CIR/FrontendAction/CIRGenAction.cpp` and to
`CIRLoweringConsumer`, inherited from `cir::CIRGenConsumer`, which
implements the original `HandleTranslationUnit` interface.

I feel this may improve the readability more even without my original
patch.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Close llvm#633.

This patch introduces `-fclangir-analysis-only` option to allow the
users to consume the AST to the CIR (and potential analysis passes, this
can be done by specifying `-Xclang -fclangir-lifetime-check=""` now or
some default value in following patches) and also generating the LLVM IR
by the traditional code gen path. This will be helpful to use CIR with
real world projects without worrying the correctness and completeness of
CIR CodeGen part.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
This reverts commit f4d538f.

It's causing a circular dependency in shared lib builds. See llvm#655
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Reland llvm#638

This was reverted due to llvm#655. I
tried to address the problem in the newest commit.

The changes of the PR since the last landed one includes:
- Move the definition of `cir::CIRGenConsumer` to
`clang/include/clang/CIRFrontendAction/CIRGenConsumer.h`, and leave its
`HandleTranslationUnit` interface is left empty. So that
`cir::CIRGenConsumer` won't need to depend on CodeGen any more.
- Change the old definition of `cir::CIRGenConsumer` in
`clang/lib/CIR/FrontendAction/CIRGenAction.cpp` and to
`CIRLoweringConsumer`, inherited from `cir::CIRGenConsumer`, which
implements the original `HandleTranslationUnit` interface.

I feel this may improve the readability more even without my original
patch.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Reland llvm#638

This was reverted due to llvm#655. I
tried to address the problem in the newest commit.

The changes of the PR since the last landed one includes:
- Move the definition of `cir::CIRGenConsumer` to
`clang/include/clang/CIRFrontendAction/CIRGenConsumer.h`, and leave its
`HandleTranslationUnit` interface is left empty. So that
`cir::CIRGenConsumer` won't need to depend on CodeGen any more.
- Change the old definition of `cir::CIRGenConsumer` in
`clang/lib/CIR/FrontendAction/CIRGenAction.cpp` and to
`CIRLoweringConsumer`, inherited from `cir::CIRGenConsumer`, which
implements the original `HandleTranslationUnit` interface.

I feel this may improve the readability more even without my original
patch.
smeenai pushed a commit to smeenai/clangir that referenced this pull request Oct 9, 2024
Reland llvm#638

This was reverted due to llvm#655. I
tried to address the problem in the newest commit.

The changes of the PR since the last landed one includes:
- Move the definition of `cir::CIRGenConsumer` to
`clang/include/clang/CIRFrontendAction/CIRGenConsumer.h`, and leave its
`HandleTranslationUnit` interface is left empty. So that
`cir::CIRGenConsumer` won't need to depend on CodeGen any more.
- Change the old definition of `cir::CIRGenConsumer` in
`clang/lib/CIR/FrontendAction/CIRGenAction.cpp` and to
`CIRLoweringConsumer`, inherited from `cir::CIRGenConsumer`, which
implements the original `HandleTranslationUnit` interface.

I feel this may improve the readability more even without my original
patch.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
Close llvm#633.

This patch introduces `-fclangir-analysis-only` option to allow the
users to consume the AST to the CIR (and potential analysis passes, this
can be done by specifying `-Xclang -fclangir-lifetime-check=""` now or
some default value in following patches) and also generating the LLVM IR
by the traditional code gen path. This will be helpful to use CIR with
real world projects without worrying the correctness and completeness of
CIR CodeGen part.
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
This reverts commit f4d538f.

It's causing a circular dependency in shared lib builds. See llvm#655
keryell pushed a commit to keryell/clangir that referenced this pull request Oct 19, 2024
Reland llvm#638

This was reverted due to llvm#655. I
tried to address the problem in the newest commit.

The changes of the PR since the last landed one includes:
- Move the definition of `cir::CIRGenConsumer` to
`clang/include/clang/CIRFrontendAction/CIRGenConsumer.h`, and leave its
`HandleTranslationUnit` interface is left empty. So that
`cir::CIRGenConsumer` won't need to depend on CodeGen any more.
- Change the old definition of `cir::CIRGenConsumer` in
`clang/lib/CIR/FrontendAction/CIRGenAction.cpp` and to
`CIRLoweringConsumer`, inherited from `cir::CIRGenConsumer`, which
implements the original `HandleTranslationUnit` interface.

I feel this may improve the readability more even without my original
patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an CIR analysis-only pipeline that uses traditional codegen
2 participants