1 ; RUN: llc < %s -march=x86 | FileCheck %s
2 ; <rdar://problem/8449754>
4 define i32 @test1(i32 %sum, i32 %x) nounwind readnone ssp {
7 ; CHECK: sbbl %ecx, %ecx
9 ; CHECK: subl %ecx, %eax
10 %add4 = add i32 %x, %sum
11 %cmp = icmp ult i32 %add4, %x
12 %inc = zext i1 %cmp to i32
13 %z.0 = add i32 %add4, %inc
17 ; Instcombine transforms test1 into test2:
24 define i32 @test2(i32 %sum, i32 %x) nounwind readnone ssp {
26 %uadd = call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %x, i32 %sum)
27 %0 = extractvalue { i32, i1 } %uadd, 0
28 %cmp = extractvalue { i32, i1 } %uadd, 1
29 %inc = zext i1 %cmp to i32
30 %z.0 = add i32 %0, %inc
34 declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32) nounwind readnone