[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-04-05 Thread Erich Keane via cfe-commits
@@ -11,6 +11,24 @@ include "mlir/Pass/PassBase.td" +def CIRCanonicalize : Pass<"cir-canonicalize"> { + let summary = "Performs CIR canonicalization"; + let description = [{ +Perform canonicalizations on CIR and removes some redundant operations. + +This pass perform

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-04-05 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. https://github.com/llvm/llvm-project/pull/131891 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-03-19 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `sanitizer-x86_64-linux-android` running on `sanitizer-buildbot-android` while building `clang` at step 2 "annotate". Full details are available at: https://lab.llvm.org/buildbot/#/builders/186/builds/7443 Here is the releva

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-03-18 Thread Erich Keane via cfe-commits
@@ -326,6 +326,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, } } Opts.LLVMArgs = Args.getAllArgValues(OPT_mllvm); + erichkeane wrote: unrelated change. https://github.com/llvm/llvm-project/pull/131891 __

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-03-18 Thread Erich Keane via cfe-commits
@@ -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().Re

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-03-18 Thread Erich Keane via cfe-commits
@@ -0,0 +1,72 @@ +// RUN: cir-opt %s -cir-canonicalize -o - | FileCheck %s + +module { + cir.func @redundant_br() { +cir.br ^bb1 + ^bb1: // pred: ^bb0 +%0 = cir.alloca !cir.int, !cir.ptr>, ["a", init] {alignment = 4 : i64} +%1 = cir.const #cir.int<4> : !cir.int +

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-03-18 Thread Erich Keane via cfe-commits
@@ -412,6 +412,12 @@ class FrontendOptions { LLVM_PREFERRED_TYPE(bool) unsigned UseClangIRPipeline : 1; + /// Disable Clang IR specific (CIR) passes + unsigned ClangIRDisablePasses : 1; erichkeane wrote: Please add `LLVM_PREFERED_TYPE` to these. https:

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-03-18 Thread Erich Keane via cfe-commits
@@ -11,6 +11,24 @@ include "mlir/Pass/PassBase.td" +def CIRCanonicalize : Pass<"cir-canonicalize"> { + let summary = "Performs CIR canonicalization"; + let description = [{ +Perform canonicalizations on CIR and removes some redundant operations. + +This pass perform

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-03-18 Thread Erich Keane via cfe-commits
@@ -0,0 +1,147 @@ +//===--===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-03-18 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Andy Kaylor (andykaylor) Changes This change introduces the cir-canonicalize pass. This is a simple cir-to-cir transformation that eliminates empty scopes and redundant branches. It will be expanded in future changes to simplify other red

[clang] [CIR] Upstream cir-canonicalize pass (PR #131891)

2025-03-18 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor created https://github.com/llvm/llvm-project/pull/131891 This change introduces the cir-canonicalize pass. This is a simple cir-to-cir transformation that eliminates empty scopes and redundant branches. It will be expanded in future changes to simplify other redun