[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 18 14:02:52 PDT 2025
================
@@ -81,7 +85,31 @@ class CIRGenConsumer : public clang::ASTConsumer {
void HandleTranslationUnit(ASTContext &C) override {
Gen->HandleTranslationUnit(C);
+
+ if (!FEOptions.ClangIRDisableCIRVerifier) {
+ if (!Gen->verifyModule()) {
+ CI.getDiagnostics().Report(
+ diag::err_cir_verification_failed_pre_passes);
+ llvm::report_fatal_error(
+ "CIR codegen: module verification error before running CIR passes");
+ return;
+ }
+ }
+
mlir::ModuleOp MlirModule = Gen->getModule();
+ mlir::MLIRContext &MlirCtx = Gen->getMLIRContext();
+
+ if (!FEOptions.ClangIRDisablePasses) {
+ // Setup and run CIR pipeline.
+ std::string passOptParsingFailure;
----------------
erichkeane wrote:
unused variable?
Also, in either case, does it make sense to combine the two 'ifs'?
So :
`if (!FEOptions.ClangIRDisablePasses && !Gen->verifyModule()) ...`
https://github.com/llvm/llvm-project/pull/131891
More information about the cfe-commits
mailing list