File: copy-propagation.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (32 lines) | stat: -rw-r--r-- 1,343 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
; RUN: llc %s -mattr=+avx -o - | FileCheck %s
; Originally from http://llvm.org/PR21743.

target triple = "x86_64-pc-win32-elf"

; Copy propagation may remove COPYs if the result is only used by undef
; operands.
;
; CHECK-LABEL: foo:
; CHECK: movl	$339752784, %e[[INDIRECT_CALL1:[a-z]+]]
; CHECK: callq *%r[[INDIRECT_CALL1]]
; Copy the result in a temporary.
; Note: Technically the regalloc could have been smarter and this move not
; required, which would have hidden the bug.
; CHECK: vmovapd	%xmm0, [[TMP:%xmm[0-9]+]]
; CHECK-NOT: vxorps  %xmm0, %xmm0, %xmm0
; CHECK-NEXT: vcvtsi2sd      %rsi, %xmm0, %xmm6
; CHECK: movl	$339772768, %e[[INDIRECT_CALL2:[a-z]+]]
; CHECK-NOT: vmovapd %xmm7, %xmm0
; CHECK-NEXT: vmovapd %xmm6, %xmm1
; Set TMP in the first argument of the second call.
; CHECK-NEXT: callq *%r[[INDIRECT_CALL2]]
; CHECK: retq
define double @foo(i64 %arg) {
top:
  %tmp = call double inttoptr (i64 339752784 to ptr)(double 1.000000e+00, double 0.000000e+00)
  tail call void asm sideeffect "", "x,~{xmm1},~{xmm2},~{xmm3},~{xmm4},~{xmm5},~{xmm6},~{xmm7},~{xmm8},~{xmm9},~{xmm10},~{xmm11},~{xmm12},~{xmm13},~{xmm14},~{xmm15},~{dirflag},~{fpsr},~{flags}"(double %tmp)
  %tmp1 = sitofp i64 %arg to double
  call void inttoptr (i64 339772768 to ptr)(double %tmp, double %tmp1)
  %tmp3 = fadd double %tmp1, %tmp
  ret double %tmp3
}