You've already forked linux-packaging-mono
Imported Upstream version 5.18.0.167
Former-commit-id: 289509151e0fee68a1b591a20c9f109c3c789d3a
This commit is contained in:
parent
e19d552987
commit
b084638f15
@ -1,15 +0,0 @@
|
||||
; RUN: opt < %s -lowerswitch
|
||||
|
||||
define void @child(i32 %ct.1) {
|
||||
entry:
|
||||
switch i32 0, label %return [
|
||||
i32 3, label %UnifiedExitNode
|
||||
i32 0, label %return
|
||||
]
|
||||
return: ; preds = %entry, %entry
|
||||
%result.0 = phi i32* [ null, %entry ], [ null, %entry ] ; <i32*> [#uses=0]
|
||||
br label %UnifiedExitNode
|
||||
UnifiedExitNode: ; preds = %return, %entry
|
||||
ret void
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
; RUN: opt < %s -lowerswitch
|
||||
|
||||
define void @test() {
|
||||
switch i32 0, label %Next [
|
||||
]
|
||||
Next: ; preds = %0
|
||||
ret void
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
; RUN: opt < %s -lowerswitch -disable-output
|
||||
|
||||
define void @solve() {
|
||||
entry:
|
||||
%targetBlock = call i16 @solve_code( ) ; <i16> [#uses=1]
|
||||
br label %codeReplTail
|
||||
then.1: ; preds = %codeReplTail
|
||||
ret void
|
||||
loopexit.0: ; preds = %codeReplTail
|
||||
ret void
|
||||
codeReplTail: ; preds = %codeReplTail, %entry
|
||||
switch i16 %targetBlock, label %codeReplTail [
|
||||
i16 0, label %loopexit.0
|
||||
i16 1, label %then.1
|
||||
]
|
||||
}
|
||||
|
||||
declare i16 @solve_code()
|
||||
|
@ -1,27 +0,0 @@
|
||||
; RUN: opt < %s -lowerswitch -S | FileCheck %s
|
||||
; CHECK-NOT: icmp eq i32 %0, 1
|
||||
|
||||
define i32 @foo(i32 %a) #0 {
|
||||
entry:
|
||||
%retval = alloca i32, align 4
|
||||
%a.addr = alloca i32, align 4
|
||||
store i32 %a, i32* %a.addr, align 4
|
||||
%0 = load i32, i32* %a.addr, align 4
|
||||
switch i32 %0, label %sw.default [
|
||||
i32 0, label %sw.bb
|
||||
i32 1, label %sw.bb1
|
||||
i32 2, label %sw.bb2
|
||||
]
|
||||
|
||||
sw.bb:
|
||||
ret i32 12
|
||||
|
||||
sw.bb1:
|
||||
ret i32 4
|
||||
|
||||
sw.bb2:
|
||||
ret i32 2
|
||||
|
||||
sw.default:
|
||||
ret i32 9
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
; RUN: opt < %s -lowerswitch -S | FileCheck %s
|
||||
;
|
||||
; The switch is lowered with a single icmp.
|
||||
; CHECK: icmp
|
||||
; CHECK-NOT: icmp
|
||||
;
|
||||
;int foo(int a) {
|
||||
;
|
||||
; switch (a) {
|
||||
; case 0:
|
||||
; return 10;
|
||||
; case 1:
|
||||
; return 3;
|
||||
; default:
|
||||
; __builtin_unreachable();
|
||||
; }
|
||||
;
|
||||
;}
|
||||
|
||||
define i32 @foo(i32 %a) {
|
||||
%1 = alloca i32, align 4
|
||||
%2 = alloca i32, align 4
|
||||
store i32 %a, i32* %2, align 4
|
||||
%3 = load i32, i32* %2, align 4
|
||||
switch i32 %3, label %6 [
|
||||
i32 0, label %4
|
||||
i32 1, label %5
|
||||
]
|
||||
|
||||
; <label>:4
|
||||
store i32 10, i32* %1
|
||||
br label %7
|
||||
|
||||
; <label>:5
|
||||
store i32 3, i32* %1
|
||||
br label %7
|
||||
|
||||
; <label>:6
|
||||
unreachable
|
||||
|
||||
; <label>:7
|
||||
%8 = load i32, i32* %1
|
||||
ret i32 %8
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
; RUN: opt < %s -lowerswitch -S | FileCheck %s
|
||||
|
||||
define i32 @test(i32 %arg) #0 {
|
||||
; CHECK-LABEL: @test
|
||||
; CHECK: ; <label>:2
|
||||
; CHECK-NEXT: %res.0 = phi i32 [ 1, %NodeBlock ], [ 2, %1 ]
|
||||
; CHECK-NEXT: br label %3
|
||||
; CHECK: ; <label>:5
|
||||
; CHECK-NEXT: %res.3 = phi i32 [ 0, %NewDefault ], [ %res.2, %4 ]
|
||||
; CHECK-NEXT: %6 = add nsw i32 %res.3, 1
|
||||
; CHECK-NEXT: ret i32 %6
|
||||
|
||||
switch i32 %arg, label %5 [
|
||||
i32 1, label %1
|
||||
i32 2, label %2
|
||||
i32 3, label %3
|
||||
i32 4, label %4
|
||||
]
|
||||
|
||||
; <label>:1
|
||||
br label %2
|
||||
|
||||
; <label>:2
|
||||
%res.0 = phi i32 [ 1, %0 ], [ 2, %1 ]
|
||||
br label %3
|
||||
|
||||
; <label>:3
|
||||
%res.1 = phi i32 [ 0, %0 ], [ %res.0, %2 ]
|
||||
%phitmp = add nsw i32 %res.1, 2
|
||||
br label %4
|
||||
|
||||
; <label>:4
|
||||
%res.2 = phi i32 [ 1, %0 ], [ %phitmp, %3 ]
|
||||
br label %5
|
||||
|
||||
; <label>:5
|
||||
%res.3 = phi i32 [ 0, %0 ], [ %res.2, %4 ]
|
||||
%6 = add nsw i32 %res.3, 1
|
||||
ret i32 %6
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
; RUN: opt < %s -lowerswitch -disable-output
|
||||
|
||||
; This test verify -lowerswitch does not crash after deleting the default block.
|
||||
|
||||
declare i32 @f(i32)
|
||||
|
||||
define i32 @unreachable(i32 %x) {
|
||||
|
||||
entry:
|
||||
switch i32 %x, label %unreachable [
|
||||
i32 5, label %a
|
||||
i32 6, label %a
|
||||
i32 7, label %a
|
||||
i32 10, label %b
|
||||
i32 20, label %b
|
||||
i32 30, label %b
|
||||
i32 40, label %b
|
||||
]
|
||||
unreachable:
|
||||
unreachable
|
||||
a:
|
||||
%0 = call i32 @f(i32 0)
|
||||
ret i32 %0
|
||||
b:
|
||||
%1 = call i32 @f(i32 1)
|
||||
ret i32 %1
|
||||
}
|
104
external/llvm/test/Transforms/LowerSwitch/feature.ll
vendored
104
external/llvm/test/Transforms/LowerSwitch/feature.ll
vendored
@ -1,104 +0,0 @@
|
||||
; RUN: opt < %s -lowerswitch -S | FileCheck %s
|
||||
|
||||
; We have switch on input.
|
||||
; On output we should got binary comparison tree. Check that all is fine.
|
||||
|
||||
;CHECK: entry:
|
||||
;CHECK-NEXT: br label %NodeBlock19
|
||||
|
||||
;CHECK: NodeBlock19: ; preds = %entry
|
||||
;CHECK-NEXT: %Pivot20 = icmp slt i32 %tmp158, 10
|
||||
;CHECK-NEXT: br i1 %Pivot20, label %NodeBlock5, label %NodeBlock17
|
||||
|
||||
;CHECK: NodeBlock17: ; preds = %NodeBlock19
|
||||
;CHECK-NEXT: %Pivot18 = icmp slt i32 %tmp158, 13
|
||||
;CHECK-NEXT: br i1 %Pivot18, label %NodeBlock9, label %NodeBlock15
|
||||
|
||||
;CHECK: NodeBlock15: ; preds = %NodeBlock17
|
||||
;CHECK-NEXT: %Pivot16 = icmp slt i32 %tmp158, 14
|
||||
;CHECK-NEXT: br i1 %Pivot16, label %bb330, label %NodeBlock13
|
||||
|
||||
;CHECK: NodeBlock13: ; preds = %NodeBlock15
|
||||
;CHECK-NEXT: %Pivot14 = icmp slt i32 %tmp158, 15
|
||||
;CHECK-NEXT: br i1 %Pivot14, label %bb332, label %LeafBlock11
|
||||
|
||||
;CHECK: LeafBlock11: ; preds = %NodeBlock13
|
||||
;CHECK-NEXT: %SwitchLeaf12 = icmp eq i32 %tmp158, 15
|
||||
;CHECK-NEXT: br i1 %SwitchLeaf12, label %bb334, label %NewDefault
|
||||
|
||||
;CHECK: NodeBlock9: ; preds = %NodeBlock17
|
||||
;CHECK-NEXT: %Pivot10 = icmp slt i32 %tmp158, 11
|
||||
;CHECK-NEXT: br i1 %Pivot10, label %bb324, label %NodeBlock7
|
||||
|
||||
;CHECK: NodeBlock7: ; preds = %NodeBlock9
|
||||
;CHECK-NEXT: %Pivot8 = icmp slt i32 %tmp158, 12
|
||||
;CHECK-NEXT: br i1 %Pivot8, label %bb326, label %bb328
|
||||
|
||||
;CHECK: NodeBlock5: ; preds = %NodeBlock19
|
||||
;CHECK-NEXT: %Pivot6 = icmp slt i32 %tmp158, 7
|
||||
;CHECK-NEXT: br i1 %Pivot6, label %NodeBlock, label %NodeBlock3
|
||||
|
||||
;CHECK: NodeBlock3: ; preds = %NodeBlock5
|
||||
;CHECK-NEXT: %Pivot4 = icmp slt i32 %tmp158, 8
|
||||
;CHECK-NEXT: br i1 %Pivot4, label %bb, label %NodeBlock1
|
||||
|
||||
;CHECK: NodeBlock1: ; preds = %NodeBlock3
|
||||
;CHECK-NEXT: %Pivot2 = icmp slt i32 %tmp158, 9
|
||||
;CHECK-NEXT: br i1 %Pivot2, label %bb338, label %bb322
|
||||
|
||||
;CHECK: NodeBlock: ; preds = %NodeBlock5
|
||||
;CHECK-NEXT: %Pivot = icmp slt i32 %tmp158, 0
|
||||
;CHECK-NEXT: br i1 %Pivot, label %LeafBlock, label %bb338
|
||||
|
||||
;CHECK: LeafBlock: ; preds = %NodeBlock
|
||||
;CHECK-NEXT: %tmp158.off = add i32 %tmp158, 6
|
||||
;CHECK-NEXT: %SwitchLeaf = icmp ule i32 %tmp158.off, 4
|
||||
;CHECK-NEXT: br i1 %SwitchLeaf, label %bb338, label %NewDefault
|
||||
|
||||
define i32 @main(i32 %tmp158) {
|
||||
entry:
|
||||
|
||||
switch i32 %tmp158, label %bb336 [
|
||||
i32 -2, label %bb338
|
||||
i32 -3, label %bb338
|
||||
i32 -4, label %bb338
|
||||
i32 -5, label %bb338
|
||||
i32 -6, label %bb338
|
||||
i32 0, label %bb338
|
||||
i32 1, label %bb338
|
||||
i32 2, label %bb338
|
||||
i32 3, label %bb338
|
||||
i32 4, label %bb338
|
||||
i32 5, label %bb338
|
||||
i32 6, label %bb338
|
||||
i32 7, label %bb
|
||||
i32 8, label %bb338
|
||||
i32 9, label %bb322
|
||||
i32 10, label %bb324
|
||||
i32 11, label %bb326
|
||||
i32 12, label %bb328
|
||||
i32 13, label %bb330
|
||||
i32 14, label %bb332
|
||||
i32 15, label %bb334
|
||||
]
|
||||
bb:
|
||||
ret i32 2
|
||||
bb322:
|
||||
ret i32 3
|
||||
bb324:
|
||||
ret i32 4
|
||||
bb326:
|
||||
ret i32 5
|
||||
bb328:
|
||||
ret i32 6
|
||||
bb330:
|
||||
ret i32 7
|
||||
bb332:
|
||||
ret i32 8
|
||||
bb334:
|
||||
ret i32 9
|
||||
bb336:
|
||||
ret i32 10
|
||||
bb338:
|
||||
ret i32 11
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
; RUN: opt %s -lowerswitch -S | FileCheck %s
|
||||
|
||||
define void @foo(i32 %x, i32* %p) {
|
||||
; Cases 2 and 4 are removed and become the new default case.
|
||||
; It is now enough to use two icmps to lower the switch.
|
||||
;
|
||||
; CHECK-LABEL: @foo
|
||||
; CHECK: icmp slt i32 %x, 5
|
||||
; CHECK: icmp eq i32 %x, 1
|
||||
; CHECK-NOT: icmp
|
||||
;
|
||||
entry:
|
||||
switch i32 %x, label %default [
|
||||
i32 1, label %bb0
|
||||
i32 2, label %popular
|
||||
i32 4, label %popular
|
||||
i32 5, label %bb1
|
||||
]
|
||||
bb0:
|
||||
store i32 0, i32* %p
|
||||
br label %exit
|
||||
bb1:
|
||||
store i32 1, i32* %p
|
||||
br label %exit
|
||||
popular:
|
||||
store i32 2, i32* %p
|
||||
br label %exit
|
||||
exit:
|
||||
ret void
|
||||
default:
|
||||
unreachable
|
||||
}
|
||||
|
||||
define void @unreachable_gap(i64 %x, i32* %p) {
|
||||
; Cases 6 and INT64_MAX become the new default, but we still exploit the fact
|
||||
; that 3-4 is unreachable, so four icmps is enough.
|
||||
|
||||
; CHECK-LABEL: @unreachable_gap
|
||||
; CHECK: icmp slt i64 %x, 2
|
||||
; CHECK: icmp slt i64 %x, 5
|
||||
; CHECK: icmp eq i64 %x, 5
|
||||
; CHECK: icmp slt i64 %x, 1
|
||||
; CHECK-NOT: icmp
|
||||
|
||||
entry:
|
||||
switch i64 %x, label %default [
|
||||
i64 -9223372036854775808, label %bb0
|
||||
i64 1, label %bb1
|
||||
i64 2, label %bb2
|
||||
i64 5, label %bb3
|
||||
i64 6, label %bb4
|
||||
i64 9223372036854775807, label %bb4
|
||||
]
|
||||
bb0:
|
||||
store i32 0, i32* %p
|
||||
br label %exit
|
||||
bb1:
|
||||
store i32 1, i32* %p
|
||||
br label %exit
|
||||
bb2:
|
||||
store i32 2, i32* %p
|
||||
br label %exit
|
||||
bb3:
|
||||
store i32 3, i32* %p
|
||||
br label %exit
|
||||
bb4:
|
||||
store i32 4, i32* %p
|
||||
br label %exit
|
||||
exit:
|
||||
ret void
|
||||
default:
|
||||
unreachable
|
||||
}
|
||||
|
||||
|
||||
|
||||
define void @nocases(i32 %x, i32* %p) {
|
||||
; Don't fall over when there are no cases.
|
||||
;
|
||||
; CHECK-LABEL: @nocases
|
||||
; CHECK-LABEL: entry
|
||||
; CHECK-NEXT: br label %default
|
||||
;
|
||||
entry:
|
||||
switch i32 %x, label %default [
|
||||
]
|
||||
default:
|
||||
unreachable
|
||||
}
|
||||
|
||||
define void @nocasesleft(i32 %x, i32* %p) {
|
||||
; Cases 2 and 4 are removed and we are left with no cases.
|
||||
;
|
||||
; CHECK-LABEL: @nocasesleft
|
||||
; CHECK-LABEL: entry
|
||||
; CHECK-NEXT: br label %popular
|
||||
;
|
||||
entry:
|
||||
switch i32 %x, label %default [
|
||||
i32 2, label %popular
|
||||
i32 4, label %popular
|
||||
]
|
||||
popular:
|
||||
store i32 2, i32* %p
|
||||
br label %exit
|
||||
exit:
|
||||
ret void
|
||||
default:
|
||||
unreachable
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
; RUN: opt -S -lowerswitch %s | FileCheck %s
|
||||
|
||||
; CHECK-LABEL: @phi_in_dead_block(
|
||||
; CHECK-NOT: switch
|
||||
define void @phi_in_dead_block() {
|
||||
bb:
|
||||
br i1 undef, label %bb2, label %bb3
|
||||
|
||||
bb1: ; No predecessors!
|
||||
switch i32 undef, label %bb2 [
|
||||
i32 9, label %bb3
|
||||
]
|
||||
|
||||
bb2: ; preds = %bb1, %bb
|
||||
%tmp = phi i64 [ undef, %bb1 ], [ undef, %bb ]
|
||||
unreachable
|
||||
|
||||
bb3: ; preds = %bb1, %bb
|
||||
unreachable
|
||||
}
|
||||
|
||||
; CHECK-LABEL: @phi_in_dead_block_br_to_self(
|
||||
; CHECK-NOT: switch
|
||||
define void @phi_in_dead_block_br_to_self() {
|
||||
bb:
|
||||
br i1 undef, label %bb2, label %bb3
|
||||
|
||||
bb1: ; No predecessors!
|
||||
switch i32 undef, label %bb2 [
|
||||
i32 9, label %bb3
|
||||
i32 10, label %bb1
|
||||
]
|
||||
|
||||
bb2: ; preds = %bb1, %bb
|
||||
%tmp = phi i64 [ undef, %bb1 ], [ undef, %bb ]
|
||||
unreachable
|
||||
|
||||
bb3: ; preds = %bb1, %bb
|
||||
unreachable
|
||||
}
|
Reference in New Issue
Block a user