@@ -353,7 +353,7 @@ exit:
353353
354354define void @loop_contains_store_condition_load_is_chained (ptr dereferenceable (40 ) noalias %array , ptr align 8 dereferenceable (160 ) readonly %offsets , ptr align 2 dereferenceable (40 ) readonly %pred ) {
355355; CHECK-LABEL: LV: Checking a loop in 'loop_contains_store_condition_load_is_chained'
356- ; CHECK: LV: Not vectorizing: Uncountable exit condition depends on load with an address that is not an add recurrence.
356+ ; CHECK: LV: Not vectorizing: Uncountable exit condition depends on load with an address that is not an add recurrence in the loop .
357357entry:
358358 br label %for.body
359359
@@ -407,7 +407,7 @@ exit:
407407
408408define void @loop_contains_store_condition_load_requires_gather (ptr dereferenceable (40 ) noalias %array , ptr align 2 dereferenceable (512 ) readonly %pred , ptr align 1 dereferenceable (20 ) readonly %offsets ) {
409409; CHECK-LABEL: LV: Checking a loop in 'loop_contains_store_condition_load_requires_gather'
410- ; CHECK: LV: Not vectorizing: Uncountable exit condition depends on load with an address that is not an add recurrence.
410+ ; CHECK: LV: Not vectorizing: Uncountable exit condition depends on load with an address that is not an add recurrence in the loop .
411411entry:
412412 br label %for.body
413413
@@ -544,7 +544,7 @@ exit:
544544
545545define void @uncountable_exit_condition_address_is_invariant (ptr dereferenceable (40 ) noalias %array , ptr align 2 dereferenceable (2 ) readonly %pred ) {
546546; CHECK-LABEL: LV: Checking a loop in 'uncountable_exit_condition_address_is_invariant'
547- ; CHECK: LV: Not vectorizing: Uncountable exit condition depends on load with an address that is not an add recurrence.
547+ ; CHECK: LV: Not vectorizing: Uncountable exit condition depends on load with an address that is not an add recurrence in the loop .
548548entry:
549549 br label %for.body
550550
@@ -567,5 +567,40 @@ exit:
567567 ret void
568568}
569569
570+ define void @uncountable_exit_condition_address_is_addrec_in_outer_loop (ptr dereferenceable (40 ) noalias %array , ptr align 2 dereferenceable (2 ) readonly %pred ) {
571+ ; CHECK-LABEL: LV: Checking a loop in 'uncountable_exit_condition_address_is_addrec_in_outer_loop'
572+ ; CHECK: LV: Not vectorizing: Uncountable exit condition depends on load with an address that is not an add recurrence in the loop.
573+ entry:
574+ br label %outer.body
575+
576+ outer.body:
577+ %outer.iv = phi i64 [ 0 , %entry ], [ %outer.iv.next , %outer.inc ]
578+ %ee.addr = getelementptr inbounds nuw i16 , ptr %pred , i64 %outer.iv
579+ br label %for.body
580+
581+ for.body:
582+ %iv = phi i64 [ 0 , %outer.body ], [ %iv.next , %for.inc ]
583+ %st.addr = getelementptr inbounds nuw i16 , ptr %array , i64 %iv
584+ %data = load i16 , ptr %st.addr , align 2
585+ %inc = add nsw i16 %data , 1
586+ store i16 %inc , ptr %st.addr , align 2
587+ %ee.val = load i16 , ptr %ee.addr , align 2
588+ %ee.cond = icmp sgt i16 %ee.val , 500
589+ br i1 %ee.cond , label %exit , label %for.inc
590+
591+ for.inc:
592+ %iv.next = add nuw nsw i64 %iv , 1
593+ %counted.cond = icmp eq i64 %iv.next , 20
594+ br i1 %counted.cond , label %outer.inc , label %for.body
595+
596+ outer.inc:
597+ %outer.iv.next = add nuw nsw i64 %outer.iv , 1
598+ %outer.cond = icmp eq i64 %outer.iv.next , 2
599+ br i1 %outer.cond , label %exit , label %outer.body
600+
601+ exit:
602+ ret void
603+ }
604+
570605declare void @init_mem (ptr , i64 );
571606declare i64 @get_an_unknown_offset ();
0 commit comments