blob: fec0de76339548abdb33d5b838170633d5eb8efe [file] [log] [blame]
Vedant Kumare48597a2018-01-26 22:02:52 +00001; RUN: opt < %s -debugify -instcombine -S | FileCheck %s
2
3define i64 @test_sext_zext(i16 %A) {
4; CHECK-LABEL: @test_sext_zext(
5; CHECK-NEXT: [[C2:%.*]] = zext i16 %A to i64
6; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], metadata !8, metadata !DIExpression()), !dbg !13
7; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 [[C2]], metadata !10, metadata !DIExpression()), !dbg !12
8 %c1 = zext i16 %A to i32
9 %c2 = sext i32 %c1 to i64
10 ret i64 %c2
11}
12
Vedant Kumara8b8d322018-02-12 21:02:45 +000013define void @test_or(i64 %A) {
14; CHECK-LABEL: @test_or(
15; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, metadata !17, metadata !DIExpression(DW_OP_constu, 256, DW_OP_or, DW_OP_stack_value)), !dbg !18
16 %1 = or i64 %A, 256
17 ret void
18}
19
Vedant Kumar96b7dc02018-02-13 01:09:46 +000020define void @test_xor(i32 %A) {
21; CHECK-LABEL: @test_xor(
22; CHECK-NEXT: call void @llvm.dbg.value(metadata i32 %A, metadata !22, metadata !DIExpression(DW_OP_constu, 1, DW_OP_xor, DW_OP_stack_value)), !dbg !23
23 %1 = xor i32 %A, 1
24 ret void
25}
26
Vedant Kumar47b16c42018-02-13 01:09:47 +000027define void @test_sub_neg(i64 %A) {
28; CHECK-LABEL: @test_sub_neg(
29; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, metadata !27, metadata !DIExpression(DW_OP_plus_uconst, 1, DW_OP_stack_value)), !dbg !28
30 %1 = sub i64 %A, -1
31 ret void
32}
33
34define void @test_sub_pos(i64 %A) {
35; CHECK-LABEL: @test_sub_pos(
36; CHECK-NEXT: call void @llvm.dbg.value(metadata i64 %A, metadata !32, metadata !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value)), !dbg !33
37 %1 = sub i64 %A, 1
38 ret void
39}
40
Vedant Kumare48597a2018-01-26 22:02:52 +000041; CHECK: !8 = !DILocalVariable(name: "1", scope: !5, file: !1, line: 1, type: !9)
Vedant Kumare48597a2018-01-26 22:02:52 +000042; CHECK: !10 = !DILocalVariable(name: "2", scope: !5, file: !1, line: 2, type: !11)
Vedant Kumare48597a2018-01-26 22:02:52 +000043; CHECK: !12 = !DILocation(line: 2, column: 1, scope: !5)
44; CHECK: !13 = !DILocation(line: 1, column: 1, scope: !5)
Vedant Kumara8b8d322018-02-12 21:02:45 +000045
46; CHECK: !17 = !DILocalVariable(name: "3", scope: !15, file: !1, line: 4, type: !11)
47; CHECK: !18 = !DILocation(line: 4, column: 1, scope: !15)
Vedant Kumar96b7dc02018-02-13 01:09:46 +000048
49; CHECK: !22 = !DILocalVariable(name: "4", scope: !20, file: !1, line: 6, type: !9)
50; CHECK: !23 = !DILocation(line: 6, column: 1, scope: !20)
Vedant Kumar47b16c42018-02-13 01:09:47 +000051
52; CHECK: !27 = !DILocalVariable(name: "5", scope: !25, file: !1, line: 8, type: !11)
53; CHECK: !28 = !DILocation(line: 8, column: 1, scope: !25)
54
55; CHECK: !32 = !DILocalVariable(name: "6", scope: !30, file: !1, line: 10, type: !11)
56; CHECK: !33 = !DILocation(line: 10, column: 1, scope: !30)