[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor closed https://github.com/llvm/llvm-project/pull/139154 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-16 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. lgtm https://github.com/llvm/llvm-project/pull/139154 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-15 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/139154 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Ari

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-15 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/139154 >From 803abd7bfa9aa48ba3446e6de8ffb1f20b16ec26 Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Thu, 8 May 2025 15:39:49 -0500 Subject: [PATCH 1/7] Add support for FlattenCFG switch and introduce

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-15 Thread via cfe-commits
@@ -962,6 +964,102 @@ bool cir::SwitchOp::isSimpleForm(llvm::SmallVectorImpl &cases) { }); } +//===--===// +// SwitchFlatOp +//===--===//

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-15 Thread via cfe-commits
@@ -171,6 +171,234 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-15 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/139154 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Ari

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-15 Thread Andy Kaylor via cfe-commits
@@ -962,6 +964,102 @@ bool cir::SwitchOp::isSimpleForm(llvm::SmallVectorImpl &cases) { }); } +//===--===// +// SwitchFlatOp +//===--===//

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-15 Thread Andy Kaylor via cfe-commits
@@ -171,6 +171,234 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-15 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor edited https://github.com/llvm/llvm-project/pull/139154 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-15 Thread Andy Kaylor via cfe-commits
https://github.com/andykaylor approved this pull request. Looks good with just a couple of nits. https://github.com/llvm/llvm-project/pull/139154 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cf

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-14 Thread via cfe-commits
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-14 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/139154 >From f77464dbe1de51c89fbde5e5decfc2314cd7dba6 Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Thu, 8 May 2025 15:39:49 -0500 Subject: [PATCH 1/5] Add support for FlattenCFG switch and introduce

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-13 Thread via cfe-commits
Andres-Salamanca wrote: > This is also missing a end-to-end test that proves we generate switchflatop > if we are coming all the way from source code. There are examples in the > incubator on how to check if a pass runs (you can use print-before/after) and > the IR for it. In the incubator, t

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-13 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/139154 >From f77464dbe1de51c89fbde5e5decfc2314cd7dba6 Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Thu, 8 May 2025 15:39:49 -0500 Subject: [PATCH 1/4] Add support for FlattenCFG switch and introduce

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-13 Thread via cfe-commits
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-13 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/139154 >From f77464dbe1de51c89fbde5e5decfc2314cd7dba6 Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Thu, 8 May 2025 15:39:49 -0500 Subject: [PATCH 1/3] Add support for FlattenCFG switch and introduce

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-13 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/139154 >From f77464dbe1de51c89fbde5e5decfc2314cd7dba6 Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Thu, 8 May 2025 15:39:49 -0500 Subject: [PATCH 1/2] Add support for FlattenCFG switch and introduce

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-13 Thread via cfe-commits
@@ -971,6 +971,52 @@ def SwitchOp : CIR_Op<"switch", }]; } +//===--===// +// SwitchFlatOp +//===--===// + +def SwitchFlatOp : CIR_Op<"switc

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
@@ -0,0 +1,68 @@ +// RUN: cir-opt %s | FileCheck %s +!s32i = !cir.int + +cir.func @FlatSwitchWithoutDefault(%arg0: !s32i) { + cir.switch.flat %arg0 : !s32i, ^bb2 [ +1: ^bb1 + ] + ^bb1: +cir.br ^bb2 + ^bb2: +cir.return +} + +// CHECK: cir.switch.flat %arg0 : !s32i,

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: This is also missing a end-to-end test that proves we generate switchflatop if we are coming all the way from source code. There are examples in the incubator on how to check if a pass runs (you can use print-before/after) and the IR for it. https:/

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-09 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes edited https://github.com/llvm/llvm-project/pull/139154 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread Andy Kaylor via cfe-commits
@@ -971,6 +971,52 @@ def SwitchOp : CIR_Op<"switch", }]; } +//===--===// +// SwitchFlatOp +//===--===// + +def SwitchFlatOp : CIR_Op<"switc

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread Andy Kaylor via cfe-commits
@@ -971,6 +971,52 @@ def SwitchOp : CIR_Op<"switch", }]; } +//===--===// +// SwitchFlatOp +//===--===// + +def SwitchFlatOp : CIR_Op<"switc

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread Andy Kaylor via cfe-commits
@@ -962,6 +963,102 @@ bool cir::SwitchOp::isSimpleForm(llvm::SmallVectorImpl &cases) { }); } +//===--===// +// SwitchFlatOp +//===--===//

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread Andy Kaylor via cfe-commits
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread Andy Kaylor via cfe-commits
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread Andy Kaylor via cfe-commits
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread Andy Kaylor via cfe-commits
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread Andy Kaylor via cfe-commits
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread Andy Kaylor via cfe-commits
@@ -171,6 +171,232 @@ class CIRScopeOpFlattening : public mlir::OpRewritePattern { } }; +class CIRSwitchOpFlattening : public mlir::OpRewritePattern { +public: + using OpRewritePattern::OpRewritePattern; + + inline void rewriteYieldOp(mlir::PatternRewriter &rewriter, +

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread via cfe-commits
Andres-Salamanca wrote: @andykaylor https://github.com/llvm/llvm-project/pull/139154 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (Andres-Salamanca) Changes This PR adds support for the `FlattenCFG` transformation on `switch` statements. It also introduces the `SwitchFlatOp`, which is necessary for subsequent lowering to LLVM. --- Patch is 28.96 KiB, truncat

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: None (Andres-Salamanca) Changes This PR adds support for the `FlattenCFG` transformation on `switch` statements. It also introduces the `SwitchFlatOp`, which is necessary for subsequent lowering to LLVM. --- Patch is 28.96 KiB, trunc

[clang] [CIR] Upstream support for FlattenCFG switch and SwitchFlatOp (PR #139154)

2025-05-08 Thread via cfe-commits
https://github.com/Andres-Salamanca created https://github.com/llvm/llvm-project/pull/139154 This PR adds support for the `FlattenCFG` transformation on `switch` statements. It also introduces the `SwitchFlatOp`, which is necessary for subsequent lowering to LLVM. >From f77464dbe1de51c89fbde