Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGen / indirect-goto.c
blob3da43b0fe7e63bf62d9b565e211bdbc51c451aab
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -O3 -emit-llvm -o - %s | grep "ret i32 2520"
3 static int foo(unsigned i) {
4 void *addrs[] = { &&L1, &&L2, &&L3, &&L4, &&L5 };
5 int res = 1;
7 goto *addrs[i];
8 L5: res *= 11;
9 L4: res *= 7;
10 L3: res *= 5;
11 L2: res *= 3;
12 L1: res *= 2;
13 return res;
16 static int foo2(unsigned i) {
17 static const void *addrs[] = { &&L1, &&L2, &&L3, &&L4, &&L5 };
18 int res = 1;
20 goto *addrs[i];
21 L5: res *= 11;
22 L4: res *= 7;
23 L3: res *= 5;
24 L2: res *= 3;
25 L1: res *= 2;
26 return res;
29 int main(void) {
30 return foo(3)+foo2(4);