@@ -491,101 +491,22 @@ for.end: ; preds = %for.body
491
491
ret i32 %1
492
492
}
493
493
494
- ; /// Different objects, swapped induction, alias at the end
495
- ; int noAlias15 (int a) {
496
- ; int i;
497
- ; for (i=0; i<SIZE; i++)
498
- ; Foo.A[i] = Foo.B[SIZE-i-1] + a;
499
- ; return Foo.A[a];
500
- ; }
501
- ; CHECK-LABEL: define i32 @noAlias15(
502
- ; CHECK: vector.memcheck:
503
- ; CHECK-NEXT: br i1 false, label %scalar.ph, label %vector.ph
504
- ; CHECK: add nsw <4 x i32>
505
- ; CHECK: ret
506
-
507
- define i32 @noAlias15 (i32 %a ) nounwind {
508
- entry:
509
- br label %for.body
510
-
511
- for.body: ; preds = %entry, %for.body
512
- %i.05 = phi i32 [ 0 , %entry ], [ %inc , %for.body ]
513
- %sub1 = sub nuw nsw i32 99 , %i.05
514
- %arrayidx = getelementptr inbounds %struct.anon , ptr @Foo , i32 0 , i32 2 , i32 %sub1
515
- %0 = load i32 , ptr %arrayidx , align 4
516
- %add = add nsw i32 %0 , %a
517
- %arrayidx2 = getelementptr inbounds [100 x i32 ], ptr @Foo , i32 0 , i32 %i.05
518
- store i32 %add , ptr %arrayidx2 , align 4
519
- %inc = add nuw nsw i32 %i.05 , 1
520
- %exitcond.not = icmp eq i32 %inc , 100
521
- br i1 %exitcond.not , label %for.end , label %for.body
522
-
523
- for.end: ; preds = %for.body
524
- %arrayidx3 = getelementptr inbounds [100 x i32 ], ptr @Foo , i32 0 , i32 %a
525
- %1 = load i32 , ptr %arrayidx3 , align 4
526
- ret i32 %1
527
- }
528
-
529
- ; /// Different objects, swapped induction, alias at the beginning
530
- ; int noAlias16 (int a) {
531
- ; int i;
532
- ; for (i=0; i<SIZE; i++)
533
- ; Foo.A[SIZE-i-1] = Foo.B[i] + a;
534
- ; return Foo.A[a];
535
- ; }
536
- ; CHECK-LABEL: define i32 @noAlias16(
537
- ; CHECK: entry:
538
- ; CHECK-NEXT: br i1 false, label %scalar.ph, label %vector.ph
539
-
540
- ; CHECK: add nsw <4 x i32>
541
- ; CHECK: ret
542
-
543
- define i32 @noAlias16 (i32 %a ) nounwind {
544
- entry:
545
- br label %for.body
546
-
547
- for.body: ; preds = %entry, %for.body
548
- %i.05 = phi i32 [ 0 , %entry ], [ %inc , %for.body ]
549
- %arrayidx = getelementptr inbounds %struct.anon , ptr @Foo , i32 0 , i32 2 , i32 %i.05
550
- %0 = load i32 , ptr %arrayidx , align 4
551
- %add = add nsw i32 %0 , %a
552
- %sub1 = sub nuw nsw i32 99 , %i.05
553
- %arrayidx2 = getelementptr inbounds [100 x i32 ], ptr @Foo , i32 0 , i32 %sub1
554
- store i32 %add , ptr %arrayidx2 , align 4
555
- %inc = add nuw nsw i32 %i.05 , 1
556
- %exitcond.not = icmp eq i32 %inc , 100
557
- br i1 %exitcond.not , label %for.end , label %for.body
558
-
559
- for.end: ; preds = %for.body
560
- %arrayidx3 = getelementptr inbounds [100 x i32 ], ptr @Foo , i32 0 , i32 %a
561
- %1 = load i32 , ptr %arrayidx3 , align 4
562
- ret i32 %1
563
- }
564
-
565
494
566
495
;; === Now, the tests that we could vectorize with induction changes or run-time checks ===
567
496
568
497
569
498
; /// Different objects, swapped induction, alias at the end
570
- ; int mayAlias01 (int a, int N ) {
499
+ ; int mayAlias01 (int a) {
571
500
; int i;
572
- ; for (i=0; i<N ; i++)
501
+ ; for (i=0; i<SIZE ; i++)
573
502
; Foo.A[i] = Foo.B[SIZE-i-1] + a;
574
503
; return Foo.A[a];
575
504
; }
576
505
; CHECK-LABEL: define i32 @mayAlias01(
577
- ; CHECK: vector.memcheck:
578
- ; CHECK-NEXT: [[MUL:%.+]] = shl i32 %N, 2
579
- ; CHECK-NEXT: [[SCEVGEP0:%.+]] = getelementptr i8, ptr @Foo, i32 [[MUL]]
580
- ; CHECK-NEXT: [[SUB:%.+]] = sub i32 804, [[MUL]]
581
- ; CHECK-NEXT: [[SCEVGEP1:%.+]] = getelementptr i8, ptr @Foo, i32 [[SUB]]
582
- ; CHECK-NEXT: [[BOUND:%.+]] = icmp ult ptr [[SCEVGEP1]], [[SCEVGEP0]]
583
- ; CHECK-NEXT: br i1 [[BOUND]], label %scalar.ph, label %vector.ph
584
-
585
- ; CHECK: add nsw <4 x i32>
506
+ ; CHECK-NOT: add nsw <4 x i32>
586
507
; CHECK: ret
587
508
588
- define i32 @mayAlias01 (i32 %a , i32 %N ) nounwind {
509
+ define i32 @mayAlias01 (i32 %a ) nounwind {
589
510
entry:
590
511
br label %for.body
591
512
@@ -598,7 +519,7 @@ for.body: ; preds = %entry, %for.body
598
519
%arrayidx2 = getelementptr inbounds [100 x i32 ], ptr @Foo , i32 0 , i32 %i.05
599
520
store i32 %add , ptr %arrayidx2 , align 4
600
521
%inc = add nuw nsw i32 %i.05 , 1
601
- %exitcond.not = icmp eq i32 %inc , %N
522
+ %exitcond.not = icmp eq i32 %inc , 100
602
523
br i1 %exitcond.not , label %for.end , label %for.body
603
524
604
525
for.end: ; preds = %for.body
@@ -608,20 +529,17 @@ for.end: ; preds = %for.body
608
529
}
609
530
610
531
; /// Different objects, swapped induction, alias at the beginning
611
- ; int mayAlias02 (int a, int N ) {
532
+ ; int mayAlias02 (int a) {
612
533
; int i;
613
- ; for (i=0; i<N ; i++)
534
+ ; for (i=0; i<SIZE ; i++)
614
535
; Foo.A[SIZE-i-1] = Foo.B[i] + a;
615
536
; return Foo.A[a];
616
537
; }
617
538
; CHECK-LABEL: define i32 @mayAlias02(
618
- ; CHECK: vector.memcheck:
619
- ; CHECK-NEXT: br i1 false, label %scalar.ph, label %vector.ph
620
-
621
- ; CHECK: add nsw <4 x i32>
539
+ ; CHECK-NOT: add nsw <4 x i32>
622
540
; CHECK: ret
623
541
624
- define i32 @mayAlias02 (i32 %a , i32 %N ) nounwind {
542
+ define i32 @mayAlias02 (i32 %a ) nounwind {
625
543
entry:
626
544
br label %for.body
627
545
@@ -634,7 +552,7 @@ for.body: ; preds = %entry, %for.body
634
552
%arrayidx2 = getelementptr inbounds [100 x i32 ], ptr @Foo , i32 0 , i32 %sub1
635
553
store i32 %add , ptr %arrayidx2 , align 4
636
554
%inc = add nuw nsw i32 %i.05 , 1
637
- %exitcond.not = icmp eq i32 %inc , %N
555
+ %exitcond.not = icmp eq i32 %inc , 100
638
556
br i1 %exitcond.not , label %for.end , label %for.body
639
557
640
558
for.end: ; preds = %for.body
0 commit comments