1 ; RUN: opt < %s -ipsccp -S | FileCheck %s
2 ; RUN: opt < %s -passes=ipsccp -S | FileCheck %s
5 ; CHECK-LABEL: cleanup:
6 ; CHECK-NEXT: %retval.0 = phi i32 [ 0, %if.then ], [ %add, %if.then7 ], [ %add8, %if.else ]
9 %struct.Node = type { %struct.Node*, %struct.Node*, i32 }
11 define i32 @check(%struct.Node* %node) {
13 %cmp = icmp eq %struct.Node* %node, null
14 br i1 %cmp, label %if.then, label %if.end
16 if.then: ; preds = %entry
19 if.end: ; preds = %entry
20 %left = getelementptr inbounds %struct.Node, %struct.Node* %node, i32 0, i32 0
21 %0 = load %struct.Node*, %struct.Node** %left
22 %call = call i32 @check(%struct.Node* %0)
23 %right = getelementptr inbounds %struct.Node, %struct.Node* %node, i32 0, i32 1
24 %1 = load %struct.Node*, %struct.Node** %right
25 %call1 = call i32 @check(%struct.Node* %1)
26 %2 = load %struct.Node*, %struct.Node** %right
27 %height = getelementptr inbounds %struct.Node, %struct.Node* %2, i32 0, i32 2
28 %3 = load i32, i32* %height
29 %cmp3 = icmp ne i32 %3, %call1
30 br i1 %cmp3, label %if.then4, label %if.end5
32 if.then4: ; preds = %if.end
35 if.end5: ; preds = %if.end
36 %cmp6 = icmp sgt i32 %call, %call1
37 br i1 %cmp6, label %if.then7, label %if.else
39 if.then7: ; preds = %if.end5
40 %add = add nsw i32 %call, 1
43 if.else: ; preds = %if.end5
44 %add8 = add nsw i32 %call1, 1
47 cleanup: ; preds = %if.else, %if.then7, %if.then
48 %retval.0 = phi i32 [ 0, %if.then ], [ %add, %if.then7 ], [ %add8, %if.else ]