1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S %s | FileCheck %s
4 %foo = type { ptr, i32 }
6 declare i32 @putchar(i32)
8 define i32 @intercept(%foo %f) {
9 ; CHECK-LABEL: @intercept(
10 ; CHECK-NEXT: [[FN:%.*]] = extractvalue [[FOO:%.*]] [[F:%.*]], 0
11 ; CHECK-NEXT: [[X:%.*]] = extractvalue [[FOO]] [[F]], 1
12 ; CHECK-NEXT: [[X0:%.*]] = icmp eq i32 [[X]], 0
13 ; CHECK-NEXT: br i1 [[X0]], label [[ZERO:%.*]], label [[NONZERO:%.*]]
15 ; CHECK-NEXT: [[R0:%.*]] = musttail call i32 [[FN]]([[FOO]] [[F]])
16 ; CHECK-NEXT: ret i32 [[R0]]
18 ; CHECK-NEXT: [[R1:%.*]] = tail call i32 [[FN]]([[FOO]] [[F]])
19 ; CHECK-NEXT: [[TMP1:%.*]] = tail call i32 @putchar(i32 [[R1]])
20 ; CHECK-NEXT: ret i32 [[R1]]
22 %fn = extractvalue %foo %f, 0
23 %x = extractvalue %foo %f, 1
24 %x0 = icmp eq i32 %x, 0
25 br i1 %x0, label %Zero, label %Nonzero
28 %r0 = musttail call i32 %fn(%foo %f)
32 %r1 = tail call i32 %fn(%foo %f)
33 %1 = tail call i32 @putchar(i32 %r1)