1 ; RUN: opt < %s -passes=debugify,instcombine -S | FileCheck %s
2 ; RUN: opt < %s -passes=debugify,instcombine -S --try-experimental-debuginfo-iterators | FileCheck %s
4 declare void @escape32(i32)
6 define i64 @test_sext_zext(i16 %A) {
7 ; CHECK-LABEL: @test_sext_zext(
8 ; CHECK-NEXT: [[C2:%.*]] = zext i16 %A to i64
9 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression())
10 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression())
11 %c1 = zext i16 %A to i32
12 %c2 = sext i32 %c1 to i64
16 define i64 @test_used_sext_zext(i16 %A) {
17 ; CHECK-LABEL: @test_used_sext_zext(
18 ; CHECK-NEXT: [[C1:%.*]] = zext i16 %A to i32
19 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[C1]], {{.*}}, metadata !DIExpression())
20 ; CHECK-NEXT: [[C2:%.*]] = zext i16 %A to i64
21 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression())
22 ; CHECK-NEXT: call void @escape32(i32 %c1)
23 ; CHECK-NEXT: ret i64 %c2
24 %c1 = zext i16 %A to i32
25 %c2 = sext i32 %c1 to i64
26 call void @escape32(i32 %c1)
30 define i32 @test_cast_select(i1 %cond) {
31 ; CHECK-LABEL: @test_cast_select(
32 ; CHECK-NEXT: [[sel:%.*]] = select i1 %cond, i32 3, i32 5
33 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[sel]], {{.*}}, metadata !DIExpression())
34 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[sel]], {{.*}}, metadata !DIExpression())
35 ; CHECK-NEXT: ret i32 [[sel]]
36 %sel = select i1 %cond, i16 3, i16 5
37 %cast = zext i16 %sel to i32
41 define void @test_or(i64 %A) {
42 ; CHECK-LABEL: @test_or(
43 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 256, DW_OP_or, DW_OP_stack_value))
48 define void @test_xor(i32 %A) {
49 ; CHECK-LABEL: @test_xor(
50 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 1, DW_OP_xor, DW_OP_stack_value))
55 define void @test_sub_neg(i64 %A) {
56 ; CHECK-LABEL: @test_sub_neg(
57 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value))
62 define void @test_sub_pos(i64 %A) {
63 ; CHECK-LABEL: @test_sub_pos(
64 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value))
69 define void @test_shl(i64 %A) {
70 ; CHECK-LABEL: @test_shl(
71 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shl, DW_OP_stack_value))
76 define void @test_lshr(i64 %A) {
77 ; CHECK-LABEL: @test_lshr(
78 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shr, DW_OP_stack_value))
83 define void @test_ashr(i64 %A) {
84 ; CHECK-LABEL: @test_ashr(
85 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shra, DW_OP_stack_value))
90 define void @test_mul(i64 %A) {
91 ; CHECK-LABEL: @test_mul(
92 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_mul, DW_OP_stack_value))
97 define void @test_sdiv(i64 %A) {
98 ; CHECK-LABEL: @test_sdiv(
99 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_div, DW_OP_stack_value))
104 define void @test_srem(i64 %A) {
105 ; CHECK-LABEL: @test_srem(
106 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_mod, DW_OP_stack_value))
111 define void @test_ptrtoint(ptr %P) {
112 ; CHECK-LABEL: @test_ptrtoint
113 ; CHECK-NEXT: call void @llvm.dbg.value(metadata ptr %P, {{.*}}, metadata !DIExpression())
114 %1 = ptrtoint ptr %P to i64
118 define void @test_and(i64 %A) {
119 ; CHECK-LABEL: @test_and(
120 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 256, DW_OP_and, DW_OP_stack_value))