brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 3a663f5 Raw
72 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<scops>' -polly-print-scops -disable-output < %s 2>&1 | FileCheck %s2;3;    void f(int *A, char N, char p) {4;      for (char i = 0; i < N; i++) {5;        A[i + 3] = 0;6;      }7;    }8;9; The wrap function has no inbounds GEP but the nowrap function has. Therefore,10; we will add the assumption that i+1 won't overflow only to the former.11;12; CHECK:      Function: wrap13; CHECK:      Invalid Context:14; CHECK:      [N] -> {  : N >= 126 }15;16;17; FIXME: This is a negative test as nowrap should not need an assumed context.18;        However %tmp5 in @nowrap is translated to the SCEV <3,+,1><nw><%bb2>19;        which lacks the <nsw> flags we would need to avoid runtime checks.20;21; CHECK:      Function: nowrap22; CHECK:      Invalid Context:23; CHECK-NOT:  [N] -> {  :  }24;25target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"26 27define void @wrap(ptr %A, i8 %N, i8 %p) {28bb:29  br label %bb230 31bb2:                                              ; preds = %bb7, %bb32  %indvars.iv = phi i8 [ %indvars.iv.next, %bb7 ], [ 0, %bb ]33  %tmp3 = icmp slt i8 %indvars.iv, %N34  br i1 %tmp3, label %bb4, label %bb835 36bb4:                                              ; preds = %bb237  %tmp5 = add i8 %indvars.iv, 338  %tmp6 = getelementptr i32, ptr %A, i8 %tmp539  store i32 0, ptr %tmp6, align 440  br label %bb741 42bb7:                                              ; preds = %bb443  %indvars.iv.next = add nsw nuw i8 %indvars.iv, 144  br label %bb245 46bb8:                                              ; preds = %bb247  ret void48}49 50define void @nowrap(ptr %A, i8 %N, i8 %p) {51bb:52  br label %bb253 54bb2:                                              ; preds = %bb7, %bb55  %indvars.iv = phi i8 [ %indvars.iv.next, %bb7 ], [ 0, %bb ]56  %tmp3 = icmp slt i8 %indvars.iv, %N57  br i1 %tmp3, label %bb4, label %bb858 59bb4:                                              ; preds = %bb260  %tmp5 = add nsw nuw i8 %indvars.iv, 361  %tmp6 = getelementptr inbounds i32, ptr %A, i8 %tmp562  store i32 0, ptr %tmp6, align 463  br label %bb764 65bb7:                                              ; preds = %bb466  %indvars.iv.next = add nsw nuw i8 %indvars.iv, 167  br label %bb268 69bb8:                                              ; preds = %bb270  ret void71}72