File: dbg-changes-codegen.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (81 lines) | stat: -rw-r--r-- 3,005 bytes parent folder | download | duplicates (13)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
; RUN: llc < %s -mtriple=x86_64-linux | FileCheck %s

; The Peephole optimizer should fold the load into the cmp even with debug info.
; CHECK-LABEL: _ZN3Foo3batEv
; CHECK-NOT: movq pfoo
; CHECK: cmpq {{%[a-z]+}}, pfoo(%rip)
;
; CHECK-LABEL: _Z3bazv
; CHECK-NOT: movq wibble2
; CHECK: cmpq {{%[a-z]+}}, wibble2(%rip)

; Regenerate test with this command: 
;   clang -emit-llvm -S -O2 -g
; from this source:
;   struct Foo {
;     bool bat();
;     bool operator==(Foo &arg) { return (this == &arg); }
;   };
;   Foo *pfoo;
;   bool Foo::bat() { return (*this == *pfoo); }
;
;   struct Wibble ptr wibble1, *wibble2;
;   struct Flibble {
;     void bar(Wibble *c) {
;       if (c < wibble2)
;         wibble2 = 0;
;       c->x = 0;
;     }
;   } flibble;
;   void baz() { flibble.bar(wibble1); }

%struct.Foo = type { i8 }
%struct.Wibble = type { i32 }
%struct.Flibble = type { i8 }

@pfoo = dso_local global ptr null, align 8
@wibble1 = dso_local global ptr null, align 8
@wibble2 = dso_local global ptr null, align 8
@flibble = dso_local global %struct.Flibble zeroinitializer, align 1

; Function Attrs: nounwind readonly uwtable
define zeroext i1 @_ZN3Foo3batEv(ptr %this) #0 align 2 {
entry:
  %0 = load ptr, ptr @pfoo, align 8
  tail call void @llvm.dbg.value(metadata ptr %0, i64 0, metadata !62, metadata !DIExpression()), !dbg !DILocation(scope: !1)
  %cmp.i = icmp eq ptr %0, %this
  ret i1 %cmp.i
}

; Function Attrs: nounwind uwtable
define dso_local void @_Z3bazv() #1 {
entry:
  %0 = load ptr, ptr @wibble1, align 8
  tail call void @llvm.dbg.value(metadata ptr undef, i64 0, metadata !65, metadata !DIExpression()), !dbg !DILocation(scope: !1)
  %1 = load ptr, ptr @wibble2, align 8
  %cmp.i = icmp ugt ptr %1, %0
  br i1 %cmp.i, label %if.then.i, label %_ZN7Flibble3barEP6Wibble.exit

if.then.i:                                        ; preds = %entry
  store ptr null, ptr @wibble2, align 8
  br label %_ZN7Flibble3barEP6Wibble.exit

_ZN7Flibble3barEP6Wibble.exit:                    ; preds = %entry, %if.then.i
  store i32 0, ptr %0, align 4
  ret void
}

; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2

attributes #0 = { nounwind readonly uwtable "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #2 = { nounwind readnone }

!1 = distinct !DISubprogram()

!17 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: null)
!45 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: null)
!62 = !DILocalVariable(name: "arg", line: 4, arg: 2, scope: !1, type: !17)
!64 = !{ptr undef}
!65 = !DILocalVariable(name: "this", line: 13, arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !1, type: !45)