1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=ipsccp -S | FileCheck %s
6 define internal %0 @foo(i1 %Q) {
8 ; CHECK-NEXT: br i1 [[Q:%.*]], label [[T:%.*]], label [[F:%.*]]
10 ; CHECK-NEXT: ret [[TMP0:%.*]] { i32 21, i32 22 }
12 ; CHECK-NEXT: ret [[TMP0]] { i32 21, i32 23 }
14 br i1 %Q, label %T, label %F
17 %mrv = insertvalue %0 undef, i32 21, 0
18 %mrv1 = insertvalue %0 %mrv, i32 22, 1
22 %mrv2 = insertvalue %0 undef, i32 21, 0
23 %mrv3 = insertvalue %0 %mrv2, i32 23, 1
27 define internal %0 @bar(i1 %Q) {
29 ; CHECK-NEXT: br i1 [[Q:%.*]], label [[T:%.*]], label [[F:%.*]]
31 ; CHECK-NEXT: ret [[TMP0:%.*]] { i32 21, i32 22 }
33 ; CHECK-NEXT: ret [[TMP0]] { i32 21, i32 23 }
35 %A = insertvalue %0 undef, i32 21, 0
36 br i1 %Q, label %T, label %F
39 %B = insertvalue %0 %A, i32 22, 1
43 %C = insertvalue %0 %A, i32 23, 1
47 define %0 @caller(i1 %Q) {
48 ; CHECK-LABEL: @caller(
49 ; CHECK-NEXT: [[X:%.*]] = call [[TMP0:%.*]] @foo(i1 [[Q:%.*]])
50 ; CHECK-NEXT: [[B:%.*]] = extractvalue [[TMP0]] [[X]], 1
51 ; CHECK-NEXT: [[Y:%.*]] = call [[TMP0]] @bar(i1 [[Q]])
52 ; CHECK-NEXT: [[D:%.*]] = extractvalue [[TMP0]] [[Y]], 1
53 ; CHECK-NEXT: [[N:%.*]] = add nuw nsw i32 [[B]], [[D]]
54 ; CHECK-NEXT: ret [[TMP0]] [[X]]
56 %X = call %0 @foo(i1 %Q)
57 %A = extractvalue %0 %X, 0
58 %B = extractvalue %0 %X, 1
59 %Y = call %0 @bar(i1 %Q)
60 %C = extractvalue %0 %Y, 0
61 %D = extractvalue %0 %Y, 1