1 ; RUN: opt < %s -newgvn -S | FileCheck %s
6 define i64 @test1(i64 %a, i64 %b) nounwind ssp {
8 %uadd = tail call %0 @llvm.uadd.with.overflow.i64(i64 %a, i64 %b)
9 %uadd.0 = extractvalue %0 %uadd, 0
10 %add1 = add i64 %a, %b
11 %add2 = add i64 %add1, %uadd.0
15 ; CHECK-LABEL: @test1(
19 define i64 @test2(i64 %a, i64 %b) nounwind ssp {
21 %usub = tail call %0 @llvm.usub.with.overflow.i64(i64 %a, i64 %b)
22 %usub.0 = extractvalue %0 %usub, 0
23 %sub1 = sub i64 %a, %b
24 %add2 = add i64 %sub1, %usub.0
28 ; CHECK-LABEL: @test2(
32 define i64 @test3(i64 %a, i64 %b) nounwind ssp {
34 %umul = tail call %0 @llvm.umul.with.overflow.i64(i64 %a, i64 %b)
35 %umul.0 = extractvalue %0 %umul, 0
36 %mul1 = mul i64 %a, %b
37 %add2 = add i64 %mul1, %umul.0
41 ; CHECK-LABEL: @test3(
45 define i64 @test4(i64 %a, i64 %b) nounwind ssp {
47 %sadd = tail call %0 @llvm.sadd.with.overflow.i64(i64 %a, i64 %b)
48 %sadd.0 = extractvalue %0 %sadd, 0
49 %add1 = add i64 %a, %b
50 %add2 = add i64 %add1, %sadd.0
54 ; CHECK-LABEL: @test4(
58 define i64 @test5(i64 %a, i64 %b) nounwind ssp {
60 %ssub = tail call %0 @llvm.ssub.with.overflow.i64(i64 %a, i64 %b)
61 %ssub.0 = extractvalue %0 %ssub, 0
62 %sub1 = sub i64 %a, %b
63 %add2 = add i64 %sub1, %ssub.0
67 ; CHECK-LABEL: @test5(
71 define i64 @test6(i64 %a, i64 %b) nounwind ssp {
73 %smul = tail call %0 @llvm.smul.with.overflow.i64(i64 %a, i64 %b)
74 %smul.0 = extractvalue %0 %smul, 0
75 %mul1 = mul i64 %a, %b
76 %add2 = add i64 %mul1, %smul.0
80 ; CHECK-LABEL: @test6(
84 declare void @exit(i32) noreturn
85 declare %0 @llvm.uadd.with.overflow.i64(i64, i64) nounwind readnone
86 declare %0 @llvm.usub.with.overflow.i64(i64, i64) nounwind readnone
87 declare %0 @llvm.umul.with.overflow.i64(i64, i64) nounwind readnone
88 declare %0 @llvm.sadd.with.overflow.i64(i64, i64) nounwind readnone
89 declare %0 @llvm.ssub.with.overflow.i64(i64, i64) nounwind readnone
90 declare %0 @llvm.smul.with.overflow.i64(i64, i64) nounwind readnone