| ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py |
| ; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s |
| ; Test that a switch going to a switch on the same value can be merged. |
| ; All three switches in this example can be merged into one big one. |
| define void @test1(i32 %V) { |
| ; CHECK-NEXT: switch i32 [[V:%.*]], label [[INFLOOP:%.*]] [ |
| ; CHECK-NEXT: i32 4, label [[A:%.*]] |
| ; CHECK-NEXT: i32 17, label [[B:%.*]] |
| ; CHECK-NEXT: i32 18, label [[B]] |
| ; CHECK-NEXT: i32 42, label [[D:%.*]] |
| ; CHECK-NEXT: call void @foo1() |
| ; CHECK-NEXT: call void @foo2() |
| ; CHECK-NEXT: call void @foo4() |
| ; CHECK-NEXT: br label [[INFLOOP]] |
| switch i32 %V, label %F [ |
| switch i32 %V, label %F [ |
| F: ; preds = %F, %T, %0, %0 |
| switch i32 %V, label %F [ |