Skip to content

[CIR] Upstream support for switch statements #132491

@andykaylor

Description

@andykaylor

Overview

Upstream support for switch statements and the cir.switch and cir.case operations.

Suggested minimal test case

int f(int a) {
  switch (a) {
    case 0: return 10;
    case 1: return 20;
    default: return 30;
  }
}

Note: The cir.break statement will be upstreamed as part of #132490. Please wait for that to avoid duplicate work. The upstreaming of switch statements without break statements can be handled independently.

Existing incubator tests

clang/test/CIR/CodeGen/switch.cpp

Metadata

Metadata

Labels

ClangIRAnything related to the ClangIR project

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions