1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
3 define void @redundant_add(i64 %n) {
4 ; Check that we don't create two additions for the sadd.with.overflow.
5 ; CHECK-LABEL: redundant_add
14 %i = phi i64 [ 0, %entry ], [ %i.next, %loop ]
15 %c = icmp slt i64 %i, %n
16 br i1 %c, label %loop, label %exit
19 %i.o = tail call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %i, i64 1)
20 %i.next = extractvalue { i64, i1 } %i.o, 0
21 %o = extractvalue { i64, i1 } %i.o, 1
22 br i1 %o, label %overflow, label %exit_check
28 tail call void @llvm.trap()
32 declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64)
33 declare void @llvm.trap()