brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.5 KiB · 9471e4a Raw
109 lines · plain
1; RUN: opt < %s -passes=loop-vectorize -pass-remarks-missed='loop-vectorize' -mtriple=x86_64-unknown-linux -S 2>&1 | FileCheck %s2 3; Verify analysis remarks are generated when interleaving is not beneficial.4; CHECK: remark: vectorization-remarks-profitable.c:5:17: the cost-model indicates that vectorization is not beneficial5; CHECK: remark: vectorization-remarks-profitable.c:5:17: the cost-model indicates that interleaving is not beneficial and is explicitly disabled or interleave count is set to 16; CHECK: remark: vectorization-remarks-profitable.c:11:3: the cost-model indicates that vectorization is not beneficial7; CHECK: remark: vectorization-remarks-profitable.c:11:3: the cost-model indicates that interleaving is not beneficial8 9; First loop.10;  #pragma clang loop interleave(disable) unroll(disable)11;  for(int i = 0; i < n; i++) {12;    out[i] = *in[i];13;  }14 15; Second loop.16;  #pragma clang loop unroll(disable)17;  for(int i = 0; i < n; i++) {18;    out[i] = *in[i];19;  }20 21; ModuleID = 'vectorization-remarks-profitable.ll'22target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"23target triple = "x86_64-apple-macosx10.10.0"24 25; Function Attrs: nounwind uwtable26define void @do_not_interleave(ptr noalias nocapture readonly %in, ptr noalias nocapture %out, i32 %size) #0 !dbg !4 {27entry:28  %cmp.4 = icmp eq i32 %size, 0, !dbg !1029  br i1 %cmp.4, label %for.end, label %for.body.preheader, !dbg !1130 31for.body.preheader:                               ; preds = %entry32  br label %for.body, !dbg !1233 34for.body:                                         ; preds = %for.body.preheader, %for.body35  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %for.body.preheader ]36  %arrayidx = getelementptr inbounds ptr, ptr %in, i64 %indvars.iv, !dbg !1237  %0 = load ptr, ptr %arrayidx, align 8, !dbg !1238  %1 = load i32, ptr %0, align 4, !dbg !1339  %arrayidx2 = getelementptr inbounds float, ptr %out, i64 %indvars.iv, !dbg !1440  store i32 %1, ptr %arrayidx2, align 4, !dbg !1541  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !1142  %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !1143  %exitcond = icmp eq i32 %lftr.wideiv, %size, !dbg !1144  br i1 %exitcond, label %for.end.loopexit, label %for.body, !dbg !11, !llvm.loop !1645 46for.end.loopexit:                                 ; preds = %for.body47  br label %for.end, !dbg !1948 49for.end:                                          ; preds = %for.end.loopexit, %entry50  ret void, !dbg !1951}52 53; Function Attrs: nounwind uwtable54define void @interleave_not_profitable(ptr noalias nocapture readonly %in, ptr noalias nocapture %out, i32 %size) #0 !dbg !6 {55entry:56  %cmp.4 = icmp eq i32 %size, 0, !dbg !2057  br i1 %cmp.4, label %for.end, label %for.body, !dbg !2158 59for.body:                                         ; preds = %entry, %for.body60  %indvars.iv = phi i64 [ %indvars.iv.next, %for.body ], [ 0, %entry ]61  %arrayidx = getelementptr inbounds ptr, ptr %in, i64 %indvars.iv, !dbg !2262  %0 = load ptr, ptr %arrayidx, align 8, !dbg !2263  %1 = load i32, ptr %0, align 4, !dbg !2364  %arrayidx2 = getelementptr inbounds float, ptr %out, i64 %indvars.iv, !dbg !2465  store i32 %1, ptr %arrayidx2, align 4, !dbg !2566  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1, !dbg !2167  %lftr.wideiv = trunc i64 %indvars.iv.next to i32, !dbg !2168  %exitcond = icmp eq i32 %lftr.wideiv, %size, !dbg !2169  br i1 %exitcond, label %for.end, label %for.body, !dbg !21, !llvm.loop !2670 71for.end:                                          ; preds = %for.body, %entry72  ret void, !dbg !2773}74 75attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+mmx,+sse,+sse2" "use-soft-float"="false" }76 77!llvm.dbg.cu = !{!0}78!llvm.module.flags = !{!7, !8}79!llvm.ident = !{!9}80 81!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 250016)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)82!1 = !DIFile(filename: "vectorization-remarks-profitable.c", directory: "")83!2 = !{}84!4 = distinct !DISubprogram(name: "do_not_interleave", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)85!5 = !DISubroutineType(types: !2)86!6 = distinct !DISubprogram(name: "interleave_not_profitable", scope: !1, file: !1, line: 8, type: !5, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)87!7 = !{i32 2, !"Dwarf Version", i32 4}88!8 = !{i32 2, !"Debug Info Version", i32 3}89!9 = !{!"clang version 3.8.0 (trunk 250016)"}90!10 = !DILocation(line: 4, column: 23, scope: !4)91!11 = !DILocation(line: 4, column: 3, scope: !4)92!12 = !DILocation(line: 5, column: 17, scope: !4)93!13 = !DILocation(line: 5, column: 16, scope: !4)94!14 = !DILocation(line: 5, column: 7, scope: !4)95!15 = !DILocation(line: 5, column: 14, scope: !4)96!16 = distinct !{!16, !17, !18}97!17 = !{!"llvm.loop.interleave.count", i32 1}98!18 = !{!"llvm.loop.unroll.disable"}99!19 = !DILocation(line: 6, column: 1, scope: !4)100!20 = !DILocation(line: 11, column: 23, scope: !6)101!21 = !DILocation(line: 11, column: 3, scope: !6)102!22 = !DILocation(line: 12, column: 17, scope: !6)103!23 = !DILocation(line: 12, column: 16, scope: !6)104!24 = !DILocation(line: 12, column: 7, scope: !6)105!25 = !DILocation(line: 12, column: 14, scope: !6)106!26 = distinct !{!26, !18}107!27 = !DILocation(line: 13, column: 1, scope: !6)108 109