brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · c2c5c40 Raw
61 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=loop-idiom < %s -S | FileCheck %s3 4%struct.S = type { i32, i32, i8 }5 6; unsigned copy_noalias(S* __restrict a, S *b, int n) {7;   for (int i = 0; i < n; i++) {8;     a[i] = b[i];9;   }10;   return sizeof(a[0]);11; }12 13; Function Attrs: nofree nounwind uwtable mustprogress14define dso_local i32 @copy_noalias(ptr noalias nocapture %a, ptr nocapture readonly %b, i32 %n) local_unnamed_addr #0 {15; CHECK-LABEL: @copy_noalias(16; CHECK-NEXT:  entry:17; CHECK-NEXT:    [[CMP7:%.*]] = icmp sgt i32 [[N:%.*]], 018; CHECK-NEXT:    br i1 [[CMP7]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_COND_CLEANUP:%.*]]19; CHECK:       for.body.preheader:20; CHECK-NEXT:    br label [[FOR_BODY:%.*]]21; CHECK:       for.cond.cleanup.loopexit:22; CHECK-NEXT:    br label [[FOR_COND_CLEANUP]]23; CHECK:       for.cond.cleanup:24; CHECK-NEXT:    ret i32 1225; CHECK:       for.body:26; CHECK-NEXT:    [[I_08:%.*]] = phi i32 [ [[INC:%.*]], [[FOR_BODY]] ], [ 0, [[FOR_BODY_PREHEADER]] ]27; CHECK-NEXT:    [[IDXPROM:%.*]] = zext i32 [[I_08]] to i6428; CHECK-NEXT:    [[ARRAYIDX:%.*]] = getelementptr inbounds [[STRUCT_S:%.*]], ptr [[B:%.*]], i64 [[IDXPROM]]29; CHECK-NEXT:    [[ARRAYIDX2:%.*]] = getelementptr inbounds [[STRUCT_S]], ptr [[A:%.*]], i64 [[IDXPROM]]30; CHECK-NEXT:    call void @llvm.memcpy.inline.p0.p0.i64(ptr nonnull align 4 dereferenceable(12) [[ARRAYIDX2]], ptr nonnull align 4 dereferenceable(12) [[ARRAYIDX]], i64 12, i1 false)31; CHECK-NEXT:    [[INC]] = add nuw nsw i32 [[I_08]], 132; CHECK-NEXT:    [[CMP:%.*]] = icmp slt i32 [[INC]], [[N]]33; CHECK-NEXT:    br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_COND_CLEANUP_LOOPEXIT:%.*]]34;35entry:36  %cmp7 = icmp sgt i32 %n, 037  br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup38 39for.body.preheader:                               ; preds = %entry40  br label %for.body41 42for.cond.cleanup.loopexit:                        ; preds = %for.body43  br label %for.cond.cleanup44 45for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry46  ret i32 1247 48for.body:                                         ; preds = %for.body.preheader, %for.body49  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]50  %idxprom = zext i32 %i.08 to i6451  %arrayidx = getelementptr inbounds %struct.S, ptr %b, i64 %idxprom52  %arrayidx2 = getelementptr inbounds %struct.S, ptr %a, i64 %idxprom53  call void @llvm.memcpy.inline.p0.p0.i64(ptr nonnull align 4 dereferenceable(12) %arrayidx2, ptr nonnull align 4 dereferenceable(12) %arrayidx, i64 12, i1 false)54  %inc = add nuw nsw i32 %i.08, 155  %cmp = icmp slt i32 %inc, %n56  br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit57}58 59; Function Attrs: argmemonly nofree nosync nounwind willreturn60declare void @llvm.memcpy.inline.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #161