1 ; RUN: opt < %s -debugify -instcombine -S | FileCheck %s
3 declare void @escape32(i32)
5 define i64 @test_sext_zext(i16 %A) {
6 ; CHECK-LABEL: @test_sext_zext(
7 ; CHECK-NEXT: [[C2:%.*]] = zext i16 %A to i64
8 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression())
9 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression())
10 %c1 = zext i16 %A to i32
11 %c2 = sext i32 %c1 to i64
15 define i64 @test_used_sext_zext(i16 %A) {
16 ; CHECK-LABEL: @test_used_sext_zext(
17 ; CHECK-NEXT: [[C1:%.*]] = zext i16 %A to i32
18 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[C1]], {{.*}}, metadata !DIExpression())
19 ; CHECK-NEXT: [[C2:%.*]] = zext i16 %A to i64
20 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], {{.*}}, metadata !DIExpression())
21 ; CHECK-NEXT: call void @escape32(i32 %c1)
22 ; CHECK-NEXT: ret i64 %c2
23 %c1 = zext i16 %A to i32
24 %c2 = sext i32 %c1 to i64
25 call void @escape32(i32 %c1)
29 define i32 @test_cast_select(i1 %cond) {
30 ; CHECK-LABEL: @test_cast_select(
31 ; CHECK-NEXT: [[sel:%.*]] = select i1 %cond, i32 3, i32 5
32 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[sel]], {{.*}}, metadata !DIExpression())
33 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 [[sel]], {{.*}}, metadata !DIExpression())
34 ; CHECK-NEXT: ret i32 [[sel]]
35 %sel = select i1 %cond, i16 3, i16 5
36 %cast = zext i16 %sel to i32
40 define void @test_or(i64 %A) {
41 ; CHECK-LABEL: @test_or(
42 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 256, DW_OP_or, DW_OP_stack_value))
47 define void @test_xor(i32 %A) {
48 ; CHECK-LABEL: @test_xor(
49 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 1, DW_OP_xor, DW_OP_stack_value))
54 define void @test_sub_neg(i64 %A) {
55 ; CHECK-LABEL: @test_sub_neg(
56 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value))
61 define void @test_sub_pos(i64 %A) {
62 ; CHECK-LABEL: @test_sub_pos(
63 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value))
68 define void @test_shl(i64 %A) {
69 ; CHECK-LABEL: @test_shl(
70 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shl, DW_OP_stack_value))
75 define void @test_lshr(i64 %A) {
76 ; CHECK-LABEL: @test_lshr(
77 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shr, DW_OP_stack_value))
82 define void @test_ashr(i64 %A) {
83 ; CHECK-LABEL: @test_ashr(
84 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_shra, DW_OP_stack_value))
89 define void @test_mul(i64 %A) {
90 ; CHECK-LABEL: @test_mul(
91 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_mul, DW_OP_stack_value))
96 define void @test_sdiv(i64 %A) {
97 ; CHECK-LABEL: @test_sdiv(
98 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_div, DW_OP_stack_value))
103 define void @test_srem(i64 %A) {
104 ; CHECK-LABEL: @test_srem(
105 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 7, DW_OP_mod, DW_OP_stack_value))
110 define void @test_ptrtoint(i64* %P) {
111 ; CHECK-LABEL: @test_ptrtoint
112 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64* %P, {{.*}}, metadata !DIExpression())
113 %1 = ptrtoint i64* %P to i64
117 define void @test_and(i64 %A) {
118 ; CHECK-LABEL: @test_and(
119 ; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, {{.*}}, metadata !DIExpression(DW_OP_constu, 256, DW_OP_and, DW_OP_stack_value))