[clang] [CIR] Upstream initial support for switch statements (PR #137106)

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

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -422,6 +428,121 @@ mlir::LogicalResult CIRGenFunction::emitBreakStmt(const clang::BreakStmt &s) { return mlir::success(); } +template +mlir::LogicalResult +CIRGenFunction::emitCaseDefaultCascade(const T *stmt, mlir::Type condType, +

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -802,6 +804,126 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -802,6 +804,126 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -422,6 +428,121 @@ mlir::LogicalResult CIRGenFunction::emitBreakStmt(const clang::BreakStmt &s) { return mlir::success(); } +template +mlir::LogicalResult +CIRGenFunction::emitCaseDefaultCascade(const T *stmt, mlir::Type condType, +

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -422,6 +428,121 @@ mlir::LogicalResult CIRGenFunction::emitBreakStmt(const clang::BreakStmt &s) { return mlir::success(); } +template +mlir::LogicalResult +CIRGenFunction::emitCaseDefaultCascade(const T *stmt, mlir::Type condType, +

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -422,6 +428,121 @@ mlir::LogicalResult CIRGenFunction::emitBreakStmt(const clang::BreakStmt &s) { return mlir::success(); } +template +mlir::LogicalResult +CIRGenFunction::emitCaseDefaultCascade(const T *stmt, mlir::Type condType, +

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -600,3 +721,99 @@ mlir::LogicalResult CIRGenFunction::emitWhileStmt(const WhileStmt &s) { terminateBody(builder, whileOp.getBody(), getLoc(s.getEndLoc())); return mlir::success(); } + +mlir::LogicalResult CIRGenFunction::emitSwitchBody(const Stmt *s) { + // It is rare

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/137106 >From f1f56e16d524783c69016867fcdf474ac3e4e09f Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Tue, 22 Apr 2025 15:16:19 -0500 Subject: [PATCH 1/8] Add initial CIR support for switch operation --

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-28 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/137106 >From f1f56e16d524783c69016867fcdf474ac3e4e09f Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Tue, 22 Apr 2025 15:16:19 -0500 Subject: [PATCH 1/8] Add initial CIR support for switch operation --

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread via cfe-commits
@@ -600,3 +721,99 @@ mlir::LogicalResult CIRGenFunction::emitWhileStmt(const WhileStmt &s) { terminateBody(builder, whileOp.getBody(), getLoc(s.getEndLoc())); return mlir::success(); } + +mlir::LogicalResult CIRGenFunction::emitSwitchBody(const Stmt *s) { + // It is rare

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -422,6 +428,121 @@ mlir::LogicalResult CIRGenFunction::emitBreakStmt(const clang::BreakStmt &s) { return mlir::success(); } +template +mlir::LogicalResult +CIRGenFunction::emitCaseDefaultCascade(const T *stmt, mlir::Type condType, +

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -600,3 +721,99 @@ mlir::LogicalResult CIRGenFunction::emitWhileStmt(const WhileStmt &s) { terminateBody(builder, whileOp.getBody(), getLoc(s.getEndLoc())); return mlir::success(); } + +mlir::LogicalResult CIRGenFunction::emitSwitchBody(const Stmt *s) { + // It is rare

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Andy Kaylor via cfe-commits
@@ -753,6 +755,221 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/137106 >From f1f56e16d524783c69016867fcdf474ac3e4e09f Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Tue, 22 Apr 2025 15:16:19 -0500 Subject: [PATCH 1/7] Add initial CIR support for switch operation --

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/137106 >From f1f56e16d524783c69016867fcdf474ac3e4e09f Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Tue, 22 Apr 2025 15:16:19 -0500 Subject: [PATCH 1/6] Add initial CIR support for switch operation --

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/137106 >From 22bd39ed8180febabf6e7e742fdfe425ca96c127 Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Tue, 22 Apr 2025 15:16:19 -0500 Subject: [PATCH 1/6] Add initial CIR support for switch operation --

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/137106 >From da645e2445e5539e7ea53307596de684203ecd27 Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Tue, 22 Apr 2025 15:16:19 -0500 Subject: [PATCH 1/5] Add initial CIR support for switch operation --

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Henrich Lauko via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Henrich Lauko via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-25 Thread Henrich Lauko via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-24 Thread via cfe-commits
Andres-Salamanca wrote: @bcardosolopes I've added more test, let me know if there's a specific scenario you think is still missing https://github.com/llvm/llvm-project/pull/137106 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-24 Thread via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-24 Thread via cfe-commits
@@ -753,6 +755,225 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-24 Thread via cfe-commits
https://github.com/Andres-Salamanca updated https://github.com/llvm/llvm-project/pull/137106 >From da645e2445e5539e7ea53307596de684203ecd27 Mon Sep 17 00:00:00 2001 From: Andres Salamanca Date: Tue, 22 Apr 2025 15:16:19 -0500 Subject: [PATCH 1/4] Add initial CIR support for switch operation --

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-24 Thread via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-24 Thread via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-24 Thread Henrich Lauko via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-24 Thread Henrich Lauko via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-24 Thread Henrich Lauko via cfe-commits
@@ -802,6 +804,132 @@ Block *cir::BrCondOp::getSuccessorForOperands(ArrayRef operands) { return nullptr; } +//===--===// +// CaseOp +//===

[clang] [CIR] Upstream initial support for switch statements (PR #137106)

2025-04-24 Thread Henrich Lauko via cfe-commits
@@ -753,6 +755,225 @@ def ScopeOp : CIR_Op<"scope", [ ]; } +//===--===// +// SwitchOp +//===--===// + +def CaseOpKind_DT : I32EnumAttrCase<