[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
@@ -159,6 +159,107 @@ struct SimplifySelect : public OpRewritePattern { } }; +/// Simplify `cir.switch` operations by folding cascading cases +/// into a single `cir.case` with the `anyof` kind. +/// +/// This pattern identifies cascading cases within a `cir.switch` operati

[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
@@ -186,7 +288,7 @@ void CIRSimplifyPass::runOnOperation() { // Collect operations to apply patterns. llvm::SmallVector ops; getOperation()->walk([&](Operation *op) { -if (isa(op)) +if (isa(op)) bcardosolopes wrote: Can you double check if the te

[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

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

[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

2025-05-19 Thread Bruno Cardoso Lopes via cfe-commits
https://github.com/bcardosolopes commented: Overall looks good, some inline comments. https://github.com/llvm/llvm-project/pull/140649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

2025-05-19 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (Andres-Salamanca) Changes This PR introduces a new **CIR simplify for `switch` cases**, which folds multiple **cascading `Equal` cases** (that contain only a `YieldOp`) into a single `CaseOp` of kind `AnyOf`. This logic is based on

[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

2025-05-19 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clangir Author: None (Andres-Salamanca) Changes This PR introduces a new **CIR simplify for `switch` cases**, which folds multiple **cascading `Equal` cases** (that contain only a `YieldOp`) into a single `CaseOp` of kind `AnyOf`. This logic is based

[clang] Implement CIR switch case simplify with appropriate tests (PR #140649)

2025-05-19 Thread via cfe-commits
https://github.com/Andres-Salamanca created https://github.com/llvm/llvm-project/pull/140649 This PR introduces a new **CIR simplify for `switch` cases**, which folds multiple **cascading `Equal` cases** (that contain only a `YieldOp`) into a single `CaseOp` of kind `AnyOf`. This logic is bas