1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -mtriple aarch64 -aggressive-instcombine-max-scan-instrs=1 -passes="aggressive-instcombine" -S < %s | FileCheck %s -check-prefix DBG
3 ; RUN: opt -strip-debug -mtriple aarch64 -aggressive-instcombine-max-scan-instrs=1 -passes="aggressive-instcombine" -S < %s | FileCheck %s -check-prefix NODBG
5 ; The DBG and NODBG cases should be the same. I.e. we should optimize the DBG
6 ; case too even if there is a dbg.value.
8 target datalayout = "E"
10 %s = type { i16, i16 }
12 @e = global %s zeroinitializer, align 1
13 @l = global %s zeroinitializer, align 1
16 ; DBG-LABEL: define void @test() {
18 ; DBG-NEXT: [[L1:%.*]] = load i32, ptr @e, align 1
19 ; DBG-NEXT: call void @llvm.dbg.value(metadata i32 undef, metadata [[META3:![0-9]+]], metadata !DIExpression()), !dbg [[DBG5:![0-9]+]]
20 ; DBG-NEXT: store i32 [[L1]], ptr @l, align 1
23 ; NODBG-LABEL: define void @test() {
25 ; NODBG-NEXT: [[L1:%.*]] = load i32, ptr @e, align 1
26 ; NODBG-NEXT: store i32 [[L1]], ptr @l, align 1
27 ; NODBG-NEXT: ret void
30 %l1 = load i16, ptr @e, align 1
31 call void @llvm.dbg.value(metadata i32 undef, metadata !3, metadata !DIExpression()), !dbg !5
32 %l2 = load i16, ptr getelementptr inbounds (%s, ptr @e, i16 0, i32 1), align 1
33 %e2 = zext i16 %l2 to i32
34 %e1 = zext i16 %l1 to i32
35 %s1 = shl nuw i32 %e1, 16
37 store i32 %o1, ptr @l, align 1
41 declare void @llvm.dbg.value(metadata, metadata, metadata)
44 !llvm.module.flags = !{!2}
46 !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1)
47 !1 = !DIFile(filename: "foo.c", directory: "/")
48 !2 = !{i32 2, !"Debug Info Version", i32 3}
49 !3 = !DILocalVariable(scope: !4)
50 !4 = distinct !DISubprogram(unit: !0)
51 !5 = !DILocation(scope: !4)