@@ -566,6 +566,56 @@ exit:
566
566
ret void
567
567
}
568
568
569
+ ; %B.gep.0 and pointers based on it can preserve inbounds, as the inbounds
570
+ ; versionused unconditionally in the store in the latch.
571
+ ; FIXME: at the moment, inbounds is dropped from both the GEP feeding the vector load ans tore
572
+ define void @Bgep_inbounds_unconditionally_due_to_store (ptr noalias %B , ptr readonly %C ) #0 {
573
+ ; CHECK-LABEL: define void @Bgep_inbounds_unconditionally_due_to_store(
574
+ ; CHECK: vector.body:
575
+ ; CHECK-NEXT: [[INDEX:%.*]] = phi i64 [ 0, %vector.ph ], [ [[INDEX_NEXT:%.*]], %vector.body ]
576
+ ; CHECK-NEXT: [[TMP0:%.*]] = add i64 [[INDEX]], 0
577
+ ; CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds i32, ptr %C, i64 [[TMP0]]
578
+ ; CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds i32, ptr [[TMP1]], i32 0
579
+ ; CHECK-NEXT: [[WIDE_LOAD:%.*]] = load <4 x i32>, ptr [[TMP2]], align 4
580
+ ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq <4 x i32> [[WIDE_LOAD]], <i32 20, i32 20, i32 20, i32 20>
581
+ ; CHECK-NEXT: [[TMP4:%.*]] = getelementptr float, ptr %B, i64 [[TMP0]]
582
+ ; CHECK-NEXT: [[TMP5:%.*]] = getelementptr float, ptr [[TMP4]], i32 0
583
+ ; CHECK-NEXT: [[WIDE_LOAD2:%.*]] = load <4 x float>, ptr [[TMP5]], align 4
584
+ ; CHECK-NEXT: [[TMP6:%.*]] = fadd <4 x float> [[WIDE_LOAD2]], <float 2.000000e+00, float 2.000000e+00, float 2.000000e+00, float 2.000000e+00>
585
+ ; CHECK-NEXT: [[TMP7:%.*]] = xor <4 x i1> [[TMP3]], <i1 true, i1 true, i1 true, i1 true>
586
+ ; CHECK-NEXT: [[PREDPHI:%.*]] = select <4 x i1> [[TMP3]], <4 x float> <float 3.300000e+01, float 3.300000e+01, float 3.300000e+01, float 3.300000e+01>, <4 x float> [[TMP6]]
587
+ ; CHECK-NEXT: store <4 x float> [[PREDPHI]], ptr [[TMP5]], align 4
588
+ ; CHECK-NEXT: [[INDEX_NEXT]] = add nuw i64 [[INDEX]], 4
589
+ ; CHECK-NEXT: [[TMP8:%.*]] = icmp eq i64 [[INDEX_NEXT]], 10000
590
+ ; CHECK-NEXT: br i1 [[TMP8]], label %middle.block, label %vector.body
591
+
592
+ entry:
593
+ br label %loop.body
594
+
595
+ loop.body:
596
+ %iv1 = phi i64 [ 0 , %entry ], [ %iv.next , %loop.latch ]
597
+ %C.gep = getelementptr inbounds i32 , ptr %C , i64 %iv1
598
+ %C.lv = load i32 , ptr %C.gep , align 4
599
+ %cmp = icmp eq i32 %C.lv , 20
600
+ %B.gep.0 = getelementptr inbounds float , ptr %B , i64 %iv1
601
+ br i1 %cmp , label %loop.latch , label %else
602
+
603
+ else:
604
+ %B.lv = load float , ptr %B.gep.0 , align 4
605
+ %add = fadd float %B.lv , 2 .0
606
+ br label %loop.latch
607
+
608
+ loop.latch:
609
+ %add.sink = phi float [ %add , %else ], [ 33 .0 , %loop.body ]
610
+ store float %add.sink , ptr %B.gep.0 , align 4
611
+ %iv.next = add nuw nsw i64 %iv1 , 1
612
+ %exitcond.not = icmp eq i64 %iv.next , 10000
613
+ br i1 %exitcond.not , label %exit , label %loop.body
614
+
615
+ exit:
616
+ ret void
617
+ }
618
+
569
619
attributes #0 = { noinline nounwind uwtable "target-features" ="+avx512bw,+avx512cd,+avx512dq,+avx512f,+avx512vl" }
570
620
571
621
!0 = !{}
0 commit comments