1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2 ; RUN: opt -simplifycfg -S %s | FileCheck %s 3 4 %foo = type { i32 (%foo)*, i32 } 5 6 declare i32 @putchar(i32) 7 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:%.*]] 14 ; CHECK: Zero: 15 ; CHECK-NEXT: [[R0:%.*]] = musttail call i32 [[FN]](%foo [[F:%.*]]) 16 ; CHECK-NEXT: ret i32 [[R0]] 17 ; CHECK: Nonzero: 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]] 21 ; 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 26 27 Zero: 28 %r0 = musttail call i32 %fn(%foo %f) 29 ret i32 %r0 30 31 Nonzero: 32 %r1 = tail call i32 %fn(%foo %f) 33 %1 = tail call i32 @putchar(i32 %r1) 34 ret i32 %r1 35 } 36