Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 9af7ae8

Browse files
committed
[X86] Add test for PR39926; NFC
The test file shows a case where the avoid store forwarding block pass misses to copy a range (-1..1) when the load displacement changes sign. Baseline test for D55485. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348712 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent a784eca commit 9af7ae8

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

test/CodeGen/X86/pr39926.ll

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mattr=avx | FileCheck %s
3+
define i8 @test_offset(i8* %base) {
4+
; CHECK-LABEL: test_offset:
5+
; CHECK: # %bb.0: # %entry
6+
; CHECK-NEXT: pushq %rax
7+
; CHECK-NEXT: .cfi_def_cfa_offset 16
8+
; CHECK-NEXT: movb $0, 7(%rdi)
9+
; CHECK-NEXT: movw $0, 5(%rdi)
10+
; CHECK-NEXT: movl $0, 1(%rdi)
11+
; CHECK-NEXT: movzwl -4(%rdi), %eax
12+
; CHECK-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
13+
; CHECK-NEXT: movb -2(%rdi), %al
14+
; CHECK-NEXT: movb %al, -{{[0-9]+}}(%rsp)
15+
; CHECK-NEXT: movl 1(%rdi), %eax
16+
; CHECK-NEXT: movl %eax, -{{[0-9]+}}(%rsp)
17+
; CHECK-NEXT: movzwl 5(%rdi), %eax
18+
; CHECK-NEXT: movw %ax, -{{[0-9]+}}(%rsp)
19+
; CHECK-NEXT: movb 7(%rdi), %al
20+
; CHECK-NEXT: movb %al, -{{[0-9]+}}(%rsp)
21+
; CHECK-NEXT: movl 8(%rdi), %eax
22+
; CHECK-NEXT: movl %eax, -{{[0-9]+}}(%rsp)
23+
; CHECK-NEXT: movb -{{[0-9]+}}(%rsp), %al
24+
; CHECK-NEXT: popq %rcx
25+
; CHECK-NEXT: .cfi_def_cfa_offset 8
26+
; CHECK-NEXT: retq
27+
entry:
28+
%z = alloca [128 x i8], align 16
29+
%gep0 = getelementptr inbounds i8, i8* %base, i64 7
30+
store volatile i8 0, i8* %gep0
31+
%gep1 = getelementptr inbounds i8, i8* %base, i64 5
32+
%bc1 = bitcast i8* %gep1 to i16*
33+
store volatile i16 0, i16* %bc1
34+
%gep2 = getelementptr inbounds i8, i8* %base, i64 1
35+
%bc2 = bitcast i8* %gep2 to i32*
36+
store volatile i32 0, i32* %bc2
37+
38+
%y1 = getelementptr inbounds i8, i8* %base, i64 -4
39+
%y2 = bitcast [128 x i8]* %z to i8*
40+
call void @llvm.memcpy.p0i8.p0i8.i64(i8* %y2, i8* %y1, i64 16, i1 false)
41+
42+
%gep4 = getelementptr inbounds [128 x i8], [128 x i8]* %z, i64 0, i64 4
43+
%ret = load i8, i8* %gep4
44+
ret i8 %ret
45+
}
46+
47+
; Function Attrs: argmemonly nounwind
48+
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture writeonly, i8* nocapture readonly, i64, i1)

0 commit comments

Comments
 (0)