1; RUN: llc -O2 -march=bpfel -mcpu=v2 -mattr=+alu32 < %s | FileCheck %s 2; 3; For the below example, two phi node in the loop may depend on 4; each other. So implementation must handle recursion properly. 5; 6; int test(unsigned long a, unsigned long b, unsigned long c) { 7; int val = 0; 8; 9; #pragma clang loop unroll(disable) 10; for (long i = 0; i < 100; i++) { 11; if (a > b) 12; val = 1; 13; a += b; 14; if (b > c) 15; val = 1; 16; b += c; 17; } 18; 19; return val == 0 ? 1 : 0; 20; } 21 22 23define dso_local i32 @test(i64 %a, i64 %b, i64 %c) local_unnamed_addr { 24entry: 25 br label %for.body 26 27for.cond.cleanup: ; preds = %for.body 28 %cmp6 = icmp eq i32 %val.2, 0 29 %cond = zext i1 %cmp6 to i32 30 ret i32 %cond 31 32for.body: ; preds = %for.body, %entry 33 %i.018 = phi i64 [ 0, %entry ], [ %inc, %for.body ] 34 %val.017 = phi i32 [ 0, %entry ], [ %val.2, %for.body ] 35 %a.addr.016 = phi i64 [ %a, %entry ], [ %add, %for.body ] 36 %b.addr.015 = phi i64 [ %b, %entry ], [ %add5, %for.body ] 37 %cmp1 = icmp ugt i64 %a.addr.016, %b.addr.015 38 %add = add i64 %a.addr.016, %b.addr.015 39 %cmp2 = icmp ugt i64 %b.addr.015, %c 40 %0 = or i1 %cmp2, %cmp1 41 %val.2 = select i1 %0, i32 1, i32 %val.017 42 %add5 = add i64 %b.addr.015, %c 43 %inc = add nuw nsw i64 %i.018, 1 44 %exitcond = icmp eq i64 %inc, 100 45 br i1 %exitcond, label %for.cond.cleanup, label %for.body, !llvm.loop !2 46} 47; CHECK: [[VAL:r[0-9]+]] = w{{[0-9]+}} 48; CHECK-NOT: [[VAL:r[0-9]+]] <<= 32 49; CHECK-NOT: [[VAL]] >>= 32 50; CHECK: if [[VAL]] == 0 goto 51 52!2 = distinct !{!2, !3} 53!3 = !{!"llvm.loop.unroll.disable"} 54