Skip to content

Commit 79a79d1

Browse files
nikictstellar
authored andcommitted
[X86] Add test for PR49587 (NFC)
Shows a miscompile with FastISel. (cherry picked from commit 0d814ca)
1 parent f05b649 commit 79a79d1

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

llvm/test/CodeGen/X86/pr49587.ll

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc -O0 -fast-isel -mtriple=x86_64-- < %s | FileCheck %s
3+
4+
define i32 @test(i64 %arg) nounwind {
5+
; CHECK-LABEL: test:
6+
; CHECK: # %bb.0: # %entry
7+
; CHECK-NEXT: subq $1, %rdi
8+
; CHECK-NEXT: setb %al
9+
; CHECK-NEXT: xorl %eax, %eax
10+
; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
11+
; CHECK-NEXT: jb .LBB0_2
12+
; CHECK-NEXT: # %bb.1: # %no_overflow
13+
; CHECK-NEXT: movl $1, %eax
14+
; CHECK-NEXT: movl %eax, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
15+
; CHECK-NEXT: jmp .LBB0_2
16+
; CHECK-NEXT: .LBB0_2: # %merge
17+
; CHECK-NEXT: movl {{[-0-9]+}}(%r{{[sb]}}p), %eax # 4-byte Reload
18+
; CHECK-NEXT: retq
19+
entry:
20+
%usubo = tail call { i64, i1 } @llvm.usub.with.overflow.i64(i64 %arg, i64 1)
21+
%overflow = extractvalue { i64, i1 } %usubo, 1
22+
br i1 %overflow, label %merge, label %no_overflow
23+
24+
no_overflow:
25+
br label %merge
26+
27+
merge:
28+
%phi = phi i32 [ 1, %no_overflow ], [ 0, %entry ]
29+
ret i32 %phi
30+
}
31+
32+
declare { i64, i1 } @llvm.usub.with.overflow.i64(i64, i64)

0 commit comments

Comments
 (0)