File: combine_ignore_debug.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (51 lines) | stat: -rw-r--r-- 1,879 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
; RUN: opt -mtriple aarch64 -aggressive-instcombine-max-scan-instrs=1 -passes="aggressive-instcombine" -S < %s | FileCheck %s -check-prefix DBG
; RUN: opt -strip-debug -mtriple aarch64 -aggressive-instcombine-max-scan-instrs=1 -passes="aggressive-instcombine" -S < %s | FileCheck %s -check-prefix NODBG

; The DBG and NODBG cases should be the same. I.e. we should optimize the DBG
; case too even if there is a dbg.value.

target datalayout = "E"

%s = type { i16, i16 }

@e = global %s zeroinitializer, align 1
@l = global %s zeroinitializer, align 1

define void @test() {
; DBG-LABEL: define void @test() {
; DBG-NEXT:  entry:
; DBG-NEXT:    [[L1:%.*]] = load i32, ptr @e, align 1
; DBG-NEXT:      #dbg_value(i32 undef, [[META3:![0-9]+]], !DIExpression(), [[META5:![0-9]+]])
; DBG-NEXT:    store i32 [[L1]], ptr @l, align 1
; DBG-NEXT:    ret void
;
; NODBG-LABEL: define void @test() {
; NODBG-NEXT:  entry:
; NODBG-NEXT:    [[L1:%.*]] = load i32, ptr @e, align 1
; NODBG-NEXT:    store i32 [[L1]], ptr @l, align 1
; NODBG-NEXT:    ret void
;
entry:
  %l1 = load i16, ptr @e, align 1
  call void @llvm.dbg.value(metadata i32 undef, metadata !3, metadata !DIExpression()), !dbg !5
  %l2 = load i16, ptr getelementptr inbounds (%s, ptr @e, i16 0, i32 1), align 1
  %e2 = zext i16 %l2 to i32
  %e1 = zext i16 %l1 to i32
  %s1 = shl nuw i32 %e1, 16
  %o1 = or i32 %s1, %e2
  store i32 %o1, ptr @l, align 1
  ret void
}

declare void @llvm.dbg.value(metadata, metadata, metadata)

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2}

!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1)
!1 = !DIFile(filename: "foo.c", directory: "/")
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = !DILocalVariable(scope: !4)
!4 = distinct !DISubprogram(unit: !0)
!5 = !DILocation(scope: !4)