File: callbr-asm-sink.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (35 lines) | stat: -rw-r--r-- 1,109 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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s

;; Verify that the machine instructions generated from the first
;; getelementptr don't get sunk below the callbr. (Reduced from a bug
;; report.)

%struct1 = type { i8*, i32 }

define void @klist_dec_and_del(%struct1*) {
; CHECK-LABEL: klist_dec_and_del:
; CHECK:       # %bb.0:
; CHECK-NEXT:    leaq 8(%rdi), %rax
; CHECK-NEXT:    #APP
; CHECK-NEXT:    # 8(%rdi) .Ltmp0
; CHECK-NEXT:    #NO_APP
; CHECK-NEXT:  # %bb.2:
; CHECK-NEXT:    retq
; CHECK-NEXT:  .Ltmp0: # Block address taken
; CHECK-NEXT:  .LBB0_1:
; CHECK-NEXT:    movq $0, -8(%rax)
; CHECK-NEXT:    retq
  %2 = getelementptr inbounds %struct1, %struct1* %0, i64 0, i32 1
  callbr void asm sideeffect "# $0 $1", "*m,i,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %2, i8* blockaddress(@klist_dec_and_del, %3))
          to label %6 [label %3]

3:
  %4 = getelementptr i32, i32* %2, i64 -2
  %5 = bitcast i32* %4 to i8**
  store i8* null, i8** %5, align 8
  br label %6

6:
  ret void
}