brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.4 KiB · 6735577 Raw
201 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt < %s -O3 -S                                        | FileCheck --check-prefix=OLDPM %s3; RUN: opt < %s -passes="default<O3>" -S | FileCheck --check-prefix=NEWPM %s4 5target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"6target triple = "thumbv6m-none-none-eabi"7 8; Not only should we be able to to form memsets here, the original loops9; should be deleted, too.10 11; Function Attrs: nounwind12define dso_local void @arm_fill_q7(i8 signext %value, ptr %pDst, i32 %blockSize) {13; OLDPM-LABEL: @arm_fill_q7(14; OLDPM-NEXT:  entry:15; OLDPM-NEXT:    [[CMP_NOT20:%.*]] = icmp ult i32 [[BLOCKSIZE:%.*]], 416; OLDPM-NEXT:    br i1 [[CMP_NOT20]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]17; OLDPM:       while.body.preheader:18; OLDPM-NEXT:    [[TMP0:%.*]] = and i32 [[BLOCKSIZE]], -419; OLDPM-NEXT:    call void @llvm.memset.p0.i32(ptr align 1 [[PDST:%.*]], i8 [[VALUE:%.*]], i32 [[TMP0]], i1 false)20; OLDPM-NEXT:    [[SCEVGEP:%.*]] = getelementptr i8, ptr [[PDST]], i32 [[TMP0]]21; OLDPM-NEXT:    br label [[WHILE_END]]22; OLDPM:       while.end:23; OLDPM-NEXT:    [[PDST_ADDR_0_LCSSA:%.*]] = phi ptr [ [[PDST]], [[ENTRY:%.*]] ], [ [[SCEVGEP]], [[WHILE_BODY_PREHEADER]] ]24; OLDPM-NEXT:    [[REM:%.*]] = and i32 [[BLOCKSIZE]], 325; OLDPM-NEXT:    [[CMP14_NOT17:%.*]] = icmp eq i32 [[REM]], 026; OLDPM-NEXT:    br i1 [[CMP14_NOT17]], label [[WHILE_END18:%.*]], label [[WHILE_BODY16_PREHEADER:%.*]]27; OLDPM:       while.body16.preheader:28; OLDPM-NEXT:    call void @llvm.memset.p0.i32(ptr align 1 [[PDST_ADDR_0_LCSSA]], i8 [[VALUE]], i32 [[REM]], i1 false)29; OLDPM-NEXT:    br label [[WHILE_END18]]30; OLDPM:       while.end18:31; OLDPM-NEXT:    ret void32;33; NEWPM-LABEL: @arm_fill_q7(34; NEWPM-NEXT:  entry:35; NEWPM-NEXT:    [[CMP_NOT17:%.*]] = icmp ult i32 [[BLOCKSIZE:%.*]], 436; NEWPM-NEXT:    br i1 [[CMP_NOT17]], label [[WHILE_END:%.*]], label [[WHILE_BODY_PREHEADER:%.*]]37; NEWPM:       while.body.preheader:38; NEWPM-NEXT:    [[TMP0:%.*]] = and i32 [[BLOCKSIZE]], -439; NEWPM-NEXT:    call void @llvm.memset.p0.i32(ptr align 1 [[PDST:%.*]], i8 [[VALUE:%.*]], i32 [[TMP0]], i1 false)40; NEWPM-NEXT:    [[SCEVGEP:%.*]] = getelementptr i8, ptr [[PDST]], i32 [[TMP0]]41; NEWPM-NEXT:    br label [[WHILE_END]]42; NEWPM:       while.end:43; NEWPM-NEXT:    [[PDST_ADDR_0_LCSSA:%.*]] = phi ptr [ [[PDST]], [[ENTRY:%.*]] ], [ [[SCEVGEP]], [[WHILE_BODY_PREHEADER]] ]44; NEWPM-NEXT:    [[REM:%.*]] = and i32 [[BLOCKSIZE]], 345; NEWPM-NEXT:    [[CMP14_NOT20:%.*]] = icmp eq i32 [[REM]], 046; NEWPM-NEXT:    br i1 [[CMP14_NOT20]], label [[WHILE_END18:%.*]], label [[WHILE_BODY16_PREHEADER:%.*]]47; NEWPM:       while.body16.preheader:48; NEWPM-NEXT:    call void @llvm.memset.p0.i32(ptr align 1 [[PDST_ADDR_0_LCSSA]], i8 [[VALUE]], i32 [[REM]], i1 false)49; NEWPM-NEXT:    br label [[WHILE_END18]]50; NEWPM:       while.end18:51; NEWPM-NEXT:    ret void52;53entry:54  %value.addr = alloca i8, align 155  %pDst.addr = alloca ptr, align 456  %blockSize.addr = alloca i32, align 457  %blkCnt = alloca i32, align 458  %packedValue = alloca i32, align 459  store i8 %value, ptr %value.addr, align 1, !tbaa !360  store ptr %pDst, ptr %pDst.addr, align 4, !tbaa !661  store i32 %blockSize, ptr %blockSize.addr, align 4, !tbaa !862  call void @llvm.lifetime.start.p0(ptr %blkCnt)63  call void @llvm.lifetime.start.p0(ptr %packedValue)64  %0 = load i8, ptr %value.addr, align 1, !tbaa !365  %conv = sext i8 %0 to i3266  %shl = shl i32 %conv, 067  %and = and i32 %shl, 25568  %1 = load i8, ptr %value.addr, align 1, !tbaa !369  %conv1 = sext i8 %1 to i3270  %shl2 = shl i32 %conv1, 871  %and3 = and i32 %shl2, 6528072  %or = or i32 %and, %and373  %2 = load i8, ptr %value.addr, align 1, !tbaa !374  %conv4 = sext i8 %2 to i3275  %shl5 = shl i32 %conv4, 1676  %and6 = and i32 %shl5, 1671168077  %or7 = or i32 %or, %and678  %3 = load i8, ptr %value.addr, align 1, !tbaa !379  %conv8 = sext i8 %3 to i3280  %shl9 = shl i32 %conv8, 2481  %and10 = and i32 %shl9, -1677721682  %or11 = or i32 %or7, %and1083  store i32 %or11, ptr %packedValue, align 4, !tbaa !884  %4 = load i32, ptr %blockSize.addr, align 4, !tbaa !885  %shr = lshr i32 %4, 286  store i32 %shr, ptr %blkCnt, align 4, !tbaa !887  br label %while.cond88 89while.cond:                                       ; preds = %while.body, %entry90  %5 = load i32, ptr %blkCnt, align 4, !tbaa !891  %cmp = icmp ugt i32 %5, 092  br i1 %cmp, label %while.body, label %while.end93 94while.body:                                       ; preds = %while.cond95  %6 = load i32, ptr %packedValue, align 4, !tbaa !896  call void @write_q7x4_ia(ptr %pDst.addr, i32 %6)97  %7 = load i32, ptr %blkCnt, align 4, !tbaa !898  %dec = add i32 %7, -199  store i32 %dec, ptr %blkCnt, align 4, !tbaa !8100  br label %while.cond, !llvm.loop !10101 102while.end:                                        ; preds = %while.cond103  %8 = load i32, ptr %blockSize.addr, align 4, !tbaa !8104  %rem = urem i32 %8, 4105  store i32 %rem, ptr %blkCnt, align 4, !tbaa !8106  br label %while.cond13107 108while.cond13:                                     ; preds = %while.body16, %while.end109  %9 = load i32, ptr %blkCnt, align 4, !tbaa !8110  %cmp14 = icmp ugt i32 %9, 0111  br i1 %cmp14, label %while.body16, label %while.end18112 113while.body16:                                     ; preds = %while.cond13114  %10 = load i8, ptr %value.addr, align 1, !tbaa !3115  %11 = load ptr, ptr %pDst.addr, align 4, !tbaa !6116  %incdec.ptr = getelementptr inbounds i8, ptr %11, i32 1117  store ptr %incdec.ptr, ptr %pDst.addr, align 4, !tbaa !6118  store i8 %10, ptr %11, align 1, !tbaa !3119  %12 = load i32, ptr %blkCnt, align 4, !tbaa !8120  %dec17 = add i32 %12, -1121  store i32 %dec17, ptr %blkCnt, align 4, !tbaa !8122  br label %while.cond13, !llvm.loop !12123 124while.end18:                                      ; preds = %while.cond13125  call void @llvm.lifetime.end.p0(ptr %packedValue)126  call void @llvm.lifetime.end.p0(ptr %blkCnt)127  ret void128}129 130; Function Attrs: argmemonly nofree nosync nounwind willreturn131declare void @llvm.lifetime.start.p0(ptr nocapture)132 133; Function Attrs: alwaysinline nounwind134define internal void @write_q7x4_ia(ptr %pQ7, i32 %value) {135entry:136  %pQ7.addr = alloca ptr, align 4137  %value.addr = alloca i32, align 4138  %val = alloca i32, align 4139  store ptr %pQ7, ptr %pQ7.addr, align 4, !tbaa !6140  store i32 %value, ptr %value.addr, align 4, !tbaa !8141  call void @llvm.lifetime.start.p0(ptr %val)142  %0 = load i32, ptr %value.addr, align 4, !tbaa !8143  store i32 %0, ptr %val, align 4, !tbaa !8144  %1 = load i32, ptr %val, align 4, !tbaa !8145  %and = and i32 %1, 255146  %conv = trunc i32 %and to i8147  %2 = load ptr, ptr %pQ7.addr, align 4, !tbaa !6148  %3 = load ptr, ptr %2, align 4, !tbaa !6149  store i8 %conv, ptr %3, align 1, !tbaa !3150  %4 = load i32, ptr %val, align 4, !tbaa !8151  %shr = ashr i32 %4, 8152  %and1 = and i32 %shr, 255153  %conv2 = trunc i32 %and1 to i8154  %5 = load ptr, ptr %pQ7.addr, align 4, !tbaa !6155  %6 = load ptr, ptr %5, align 4, !tbaa !6156  %arrayidx3 = getelementptr inbounds i8, ptr %6, i32 1157  store i8 %conv2, ptr %arrayidx3, align 1, !tbaa !3158  %7 = load i32, ptr %val, align 4, !tbaa !8159  %shr4 = ashr i32 %7, 16160  %and5 = and i32 %shr4, 255161  %conv6 = trunc i32 %and5 to i8162  %8 = load ptr, ptr %pQ7.addr, align 4, !tbaa !6163  %9 = load ptr, ptr %8, align 4, !tbaa !6164  %arrayidx7 = getelementptr inbounds i8, ptr %9, i32 2165  store i8 %conv6, ptr %arrayidx7, align 1, !tbaa !3166  %10 = load i32, ptr %val, align 4, !tbaa !8167  %shr8 = ashr i32 %10, 24168  %and9 = and i32 %shr8, 255169  %conv10 = trunc i32 %and9 to i8170  %11 = load ptr, ptr %pQ7.addr, align 4, !tbaa !6171  %12 = load ptr, ptr %11, align 4, !tbaa !6172  %arrayidx11 = getelementptr inbounds i8, ptr %12, i32 3173  store i8 %conv10, ptr %arrayidx11, align 1, !tbaa !3174  %13 = load ptr, ptr %pQ7.addr, align 4, !tbaa !6175  %14 = load ptr, ptr %13, align 4, !tbaa !6176  %add.ptr = getelementptr inbounds i8, ptr %14, i32 4177  store ptr %add.ptr, ptr %13, align 4, !tbaa !6178  call void @llvm.lifetime.end.p0(ptr %val)179  ret void180}181 182; Function Attrs: argmemonly nofree nosync nounwind willreturn183declare void @llvm.lifetime.end.p0(ptr nocapture)184 185!llvm.module.flags = !{!0, !1}186!llvm.ident = !{!2}187 188!0 = !{i32 1, !"wchar_size", i32 4}189!1 = !{i32 1, !"min_enum_size", i32 4}190!2 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git 07f234be1ccbce131704f580aa3f117083a887f7)"}191!3 = !{!4, !4, i64 0}192!4 = !{!"omnipotent char", !5, i64 0}193!5 = !{!"Simple C/C++ TBAA"}194!6 = !{!7, !7, i64 0}195!7 = !{!"any pointer", !4, i64 0}196!8 = !{!9, !9, i64 0}197!9 = !{!"int", !4, i64 0}198!10 = distinct !{!10, !11}199!11 = !{!"llvm.loop.mustprogress"}200!12 = distinct !{!12, !11}201