@@ -442,35 +442,30 @@ loop.end:
442
442
ret i64 %retval
443
443
}
444
444
445
-
446
- define i64 @loop_contains_store (ptr %dest ) {
447
- ; CHECK-LABEL: LV: Checking a loop in 'loop_contains_store'
448
- ; CHECK: LV: Not vectorizing: Writes to memory unsupported in early exit loops
445
+ define void @exit_conditions_combined_in_single_branch (ptr noalias dereferenceable (40 ) %array , ptr readonly align 2 dereferenceable (40 ) %pred ) {
446
+ ; CHECK-LABEL: LV: Checking a loop in 'exit_conditions_combined_in_single_branch'
447
+ ; CHECK: LV: Not vectorizing: Cannot vectorize uncountable loop.
449
448
entry:
450
- %p1 = alloca [1024 x i8 ]
451
- call void @init_mem (ptr %p1 , i64 1024 )
452
- br label %loop
453
-
454
- loop:
455
- %index = phi i64 [ %index.next , %loop.inc ], [ 3 , %entry ]
456
- %arrayidx = getelementptr inbounds i32 , ptr %p1 , i64 %index
457
- %ld1 = load i32 , ptr %arrayidx , align 1
458
- %arrayidx2 = getelementptr inbounds i32 , ptr %dest , i64 %index
459
- store i32 %ld1 , ptr %arrayidx2 , align 4
460
- %cmp = icmp eq i32 %ld1 , 1
461
- br i1 %cmp , label %loop.inc , label %loop.end
462
-
463
- loop.inc:
464
- %index.next = add i64 %index , 1
465
- %exitcond = icmp ne i64 %index.next , 67
466
- br i1 %exitcond , label %loop , label %loop.end
449
+ br label %for.body
467
450
468
- loop.end:
469
- %retval = phi i64 [ %index , %loop ], [ 67 , %loop.inc ]
470
- ret i64 %retval
451
+ for.body: ; preds = %for.body, %entry
452
+ %iv = phi i64 [ 0 , %entry ], [ %iv.next , %for.body ]
453
+ %st.addr = getelementptr inbounds nuw i16 , ptr %array , i64 %iv
454
+ %data = load i16 , ptr %st.addr , align 2
455
+ %inc = add nsw i16 %data , 1
456
+ store i16 %inc , ptr %st.addr , align 2
457
+ %ee.addr = getelementptr inbounds nuw i16 , ptr %pred , i64 %iv
458
+ %ee.val = load i16 , ptr %ee.addr , align 2
459
+ %ee.cond = icmp sgt i16 %ee.val , 500
460
+ %iv.next = add nuw nsw i64 %iv , 1
461
+ %counted.cond = icmp eq i64 %iv.next , 20
462
+ %or.cond = select i1 %ee.cond , i1 true , i1 %counted.cond
463
+ br i1 %or.cond , label %exit , label %for.body
464
+
465
+ exit: ; preds = %for.body
466
+ ret void
471
467
}
472
468
473
-
474
469
define i64 @uncountable_exit_in_conditional_block (ptr %mask ) {
475
470
; CHECK-LABEL: LV: Checking a loop in 'uncountable_exit_in_conditional_block'
476
471
; CHECK: LV: Not vectorizing: Early exit is not the latch predecessor.
0 commit comments