1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -basic-aa -newgvn -S | FileCheck %s
3 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5 define void @foo(i32 %arg, i32 %arg1, i32 (i32, i32)* %arg2) {
8 ; CHECK-NEXT: br label %bb3
10 ; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ %arg1, %bb ], [ [[TMP:%.*]]4, %bb7 ]
11 ; CHECK-NEXT: [[TMP4:%.*]] = phi i32 [ %arg, %bb ], [ [[TMP]], %bb7 ]
12 ; CHECK-NEXT: [[TMP5:%.*]] = call i32 %arg2(i32 [[TMP4]], i32 [[TMP]])
13 ; CHECK-NEXT: [[TMP6:%.*]] = icmp ne i32 [[TMP5]], 0
14 ; CHECK-NEXT: br i1 [[TMP6]], label %bb7, label %bb8
16 ; CHECK-NEXT: br label %bb3
18 ; CHECK-NEXT: ret void
23 ;; While non-standard, llvm allows mutually dependent phi nodes
24 ;; Ensure we do not infinite loop trying to process them
25 bb3: ; preds = %bb7, %bb
26 %tmp = phi i32 [ %arg1, %bb ], [ %tmp4, %bb7 ]
27 %tmp4 = phi i32 [ %arg, %bb ], [ %tmp, %bb7 ]
28 %tmp5 = call i32 %arg2(i32 %tmp4, i32 %tmp)
29 %tmp6 = icmp ne i32 %tmp5, 0
30 br i1 %tmp6, label %bb7, label %bb8