-
Notifications
You must be signed in to change notification settings - Fork 104
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
Recommit [CIR][Pipeline] Support -fclangir-analysis-only #832
Conversation
7dd9b4a
to
242be05
Compare
I didn't understand why the CI fails on windows. The log says:
but I didn't touch MLIRContext and the definition of |
@ChuanqiXu9 I haven't seen this one before, it's not even related to ClangIR, very weird. Maybe it was a fluke? Try update the PR with something that triggers testing again, let's see if it reproduces |
b54c3b4
to
75edb18
Compare
Maybe some MSVC implementation details.. I solved it by adding the MLIR include dir in CodeGen conditionally. Now this is ready to review. |
clang/lib/CodeGen/CodeGenAction.cpp
Outdated
|
||
#if CLANG_ENABLE_CIR | ||
if (CI.getFrontendOpts().ClangIRAnalysisOnly) | ||
AdditionalConsumers.push_back(cir::createCIRAnalysisOnlyConsumer(CI)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit uncomfortable with touching anything under clang/lib/CodeGen
, this is going to be a hassle to upstream / convince maintainers. Can't this be done instead in the opposite way? In CIRGenAction.cpp we could dispatch the classic CodeGen if the pipeline is asking for LLVM codegen and -fclangir-analysis-only
is ON. Have you tried that and found any issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit uncomfortable with touching anything under clang/lib/CodeGen
This is the style we did for modules. It shows it is pretty stable.
Can't this be done instead in the opposite way?
But if you really want, we can do it. We just need to introduce more lines of code. Please see the newest commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the style we did for modules. It shows it is pretty stable.
The approach is sound, my point is more about trying to minimize clang changes outside CIR dirs, so for the time being is less invasive to the rest of the codebase,
But if you really want, we can do it. We just need to introduce more lines of code. Please see the newest commit.
This looks great, thanks!
970cfa8
to
0237670
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! Looks mostly good, one question remaining (and couple nits to address)
The bot failure is unrelated (#829), please ignore it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.
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.
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.
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.
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.
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.
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:
cir::CIRGenConsumer
toclang/include/clang/CIRFrontendAction/CIRGenConsumer.h
, and leave itsHandleTranslationUnit
interface is left empty. So thatcir::CIRGenConsumer
won't need to depend on CodeGen any more.cir::CIRGenConsumer
inclang/lib/CIR/FrontendAction/CIRGenAction.cpp
and toCIRLoweringConsumer
, inherited fromcir::CIRGenConsumer
, which implements the originalHandleTranslationUnit
interface.I feel this may improve the readability more even without my original patch.