brintos

brintos / llvm-project-archived public Read only

0
0
Text · 673 B · 118f0ff Raw
45 lines · plain
1; RUN: opt < %s -passes=lower-switch -S | FileCheck %s2;3; The switch is lowered with a single icmp.4; CHECK: icmp5; CHECK-NOT: icmp6;7;int foo(int a) {8;9;  switch (a) {10;  case 0:11;    return 10;12;  case 1:13;    return 3;14;  default:15;    __builtin_unreachable();16;  }17;18;}19 20define i32 @foo(i32 %a) {21  %1 = alloca i32, align 422  %2 = alloca i32, align 423  store i32 %a, ptr %2, align 424  %3 = load i32, ptr %2, align 425  switch i32 %3, label %6 [26    i32 0, label %427    i32 1, label %528  ]29 30; <label>:4 31  store i32 10, ptr %132  br label %733 34; <label>:535  store i32 3, ptr %136  br label %737 38; <label>:639  unreachable40 41; <label>:742  %8 = load i32, ptr %143  ret i32 %844}45