<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/132491>132491</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[CIR] Upstream support for switch statements
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
andykaylor
</td>
</tr>
</table>
<pre>
### 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 https://github.com/llvm/llvm-project/issues/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
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykk8uO3CoQhp8Gb0rHwth98cILz5njo2ySKJcH4FJtk6HBgnJ3-u0j3D0zPZlNpEglEPwGvvrLJVOyo0fs2OaBbR4LudAUYie9uTzJiwuxUMFcOibqa8CnE8aTxTPj_fc5UUR5hLTMc4gEhxAhnS3pCRJJwiN6SiC9AZoQtI3lTc1beallQggzRkk2-FQy3ud4eezrMo6YCA0crbdH6YAwEeRj-bstvwXvrSc4MLHPs2SiBbZ7YLyHZx4m9m-2Yb0EOKt7iEhL9FBxVr8RqztR3IkGD3JxdKfWLyrbPWay63jHx3j_MRDmM99uXqiI8unVKDhb50AhLDdb0YBMMMtIEA4wEc2J1T0TAxPDaGlaVKnDkYnBudPz9M8cww_UxMRgU1owMTFUtWhaXsJnhzmrs7TXStEkCSiAPAVrwCyzs1oSwjnEp3KlfCaxfswI70t7tjSFheC3VBJo6XMqk_TGoQHrDc7oDXpyl3dV_u-nTZTfsF4vSlJmw0SJ8V476UcmhrxmYvj3w5c8BoP_o2diuBKVep4Z7wvT1aatW1lgV-0asWnbbVMVU6e1kk2j9i3fCGy2sm3UHg8135otKn3Qhe0EFxtei0rUYid4ua-UajfCKFPzvdpWrOF4lNaV2eMyxLFY3e1Wa6vCSYUurS0khMczrCoTIndU7NbCqGVMrOHOJkqv15Alt_ZezmzzCH_WUsUSXfeXP0RVnDrxKwAA__-fxkiO">