File: debugloc-bswap.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,696 kB
  • sloc: cpp: 7,438,781; ansic: 1,393,871; asm: 1,012,926; python: 241,771; f90: 86,635; objc: 75,411; lisp: 42,144; pascal: 17,286; sh: 8,596; ml: 5,082; perl: 4,730; makefile: 3,591; awk: 3,523; javascript: 2,251; xml: 892; fortran: 672
file content (52 lines) | stat: -rw-r--r-- 2,676 bytes parent folder | download | duplicates (5)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt -passes=instcombine -S %s -o - | FileCheck %s
;; Tests that when InstCombine replaces a bswap idiom with an intrinsic, the
;; !dbg attachment from the replaced instruction is applied to all generated
;; instructions, not just the last.

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

define i32 @inflate(ptr %strm) {
; CHECK-LABEL: define i32 @inflate(
; CHECK-SAME: ptr [[STRM:%.*]]) {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    [[TMP0:%.*]] = load i64, ptr [[STRM]], align 8
; CHECK-NEXT:    [[TRUNC:%.*]] = trunc i64 [[TMP0]] to i32, !dbg [[DBG3:![0-9]+]]
; CHECK-NEXT:    [[TMP1:%.*]] = and i32 [[TRUNC]], 65535, !dbg [[DBG3]]
; CHECK-NEXT:    [[MASK:%.*]] = call i32 @llvm.bswap.i32(i32 [[TMP1]]), !dbg [[DBG3]]
; CHECK-NEXT:    [[ADD665:%.*]] = zext i32 [[MASK]] to i64, !dbg [[DBG3]]
; CHECK-NEXT:    store i64 [[ADD665]], ptr [[STRM]], align 8
; CHECK-NEXT:    ret i32 0
;
entry:
  %0 = load i64, ptr %strm, align 8
  %and660 = and i64 %0, 65280
  %shl661 = shl i64 %and660, 8
  %and663 = and i64 %0, 255
  %shl664 = shl i64 %and663, 24
  %add665 = or i64 %shl661, %shl664, !dbg !4
  store i64 %add665, ptr %strm, align 8
  ret i32 0
}

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

!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 20.0.0git")
!1 = !DIFile(filename: "/tmp/zlib_inflate.c", directory: "/tmp")
!2 = !{}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!4 = !DILocation(line: 8, column: 42, scope: !6)
!5 = !DIFile(filename: "zlib_inflate.c", directory: "/tmp")
!6 = distinct !DISubprogram(name: "inflate", scope: !5, file: !5, line: 622, type: !7, scopeLine: 625, unit: !0, retainedNodes: !2)
!7 = distinct !DISubroutineType(types: !2)
;.
; CHECK: [[META0:![0-9]+]] = distinct !DICompileUnit(language: DW_LANG_C11, file: [[META1:![0-9]+]], producer: "{{.*}}clang version {{.*}}", isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug)
; CHECK: [[META1]] = !DIFile(filename: "/tmp/zlib_inflate.c", directory: {{.*}})
; CHECK: [[DBG3]] = !DILocation(line: 8, column: 42, scope: [[META4:![0-9]+]])
; CHECK: [[META4]] = distinct !DISubprogram(name: "inflate", scope: [[META5:![0-9]+]], file: [[META5]], line: 622, type: [[META6:![0-9]+]], scopeLine: 625, spFlags: DISPFlagDefinition, unit: [[META0]], retainedNodes: [[META7:![0-9]+]])
; CHECK: [[META5]] = !DIFile(filename: "zlib_inflate.c", directory: {{.*}})
; CHECK: [[META6]] = distinct !DISubroutineType(types: [[META7]])
; CHECK: [[META7]] = !{}
;.