brintos

brintos / llvm-project-archived public Read only

0
0
Text · 10.9 KiB · c0924ea Raw
224 lines · plain
1# RUN: llc %s -run-pass x86-avoid-SFB -mtriple=x86_64-unknown-linux-gnu -o - | FileCheck %s2#3# This was generated from:4#5# using alpha = float __attribute__((ext_vector_type(4)));6#7# void bravo(alpha * __restrict__ p1, alpha * __restrict__ p2) {8#   char *p3 = (char *)p1;9#   if (p1) {10#     *p3 = 0;11#     alpha t = *p1;12#     *p2 = t;13#   }14# }15#16# Using the command line:17# clang -g -c 1.cpp -O2 -S -emit-llvm -fno-strict-aliasing --target=x86_64-unknown-unknown -o test.ll18# llc -stop-before=x86-avoid-SFB test.ll -o before.mir19#20# The IR has been modified to include a number of debug/meta instructions between the initial store and load.21# If the code treats debug/meta instructions as normal instructions, the separation between the store and load 22# will be too great to enable the optimization.23 24--- |25  ; ModuleID = 'test.ll'26  source_filename = "1.cpp"27  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"28  target triple = "x86_64-unknown-unknown"29  30  ; Function Attrs: norecurse nounwind uwtable31  define dso_local void @debug(ptr noalias %p1, ptr noalias nocapture %p2) local_unnamed_addr #0 !dbg !10 {32  entry:33    call void @llvm.dbg.value(metadata ptr %p1, metadata !21, metadata !DIExpression()), !dbg !2734    call void @llvm.dbg.value(metadata ptr %p2, metadata !22, metadata !DIExpression()), !dbg !2735    call void @llvm.dbg.value(metadata ptr %p1, metadata !23, metadata !DIExpression()), !dbg !2736    %tobool = icmp eq ptr %p1, null, !dbg !2837    %0 = bitcast ptr %p1 to ptr, !dbg !2938    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2739    store i8 0, ptr %0, align 1, !dbg !3040    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2741    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2742    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2743    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2744    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2745    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2746    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2747    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2748    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2749    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2750    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2751    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2752    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2753    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2754    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2755    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2756    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2757    call void @llvm.dbg.value(metadata ptr %0, metadata !23, metadata !DIExpression()), !dbg !2758    br i1 %tobool, label %if.end, label %if.then, !dbg !3159  60  if.then:                                          ; preds = %entry61    %1 = load <4 x float>, ptr %p1, align 16, !dbg !3262    call void @llvm.dbg.value(metadata <4 x float> %1, metadata !24, metadata !DIExpression()), !dbg !3363    store <4 x float> %1, ptr %p2, align 16, !dbg !3464    br label %if.end, !dbg !3565  66  if.end:                                           ; preds = %if.then, %entry67    ret void, !dbg !3668  }69 70  ; Function Attrs: nounwind readnone speculatable71  declare void @llvm.dbg.value(metadata, metadata, metadata) #172  73  ; Function Attrs: nounwind74  declare void @llvm.stackprotector(ptr, ptr) #275  76  attributes #0 = { norecurse nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="all" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }77  attributes #1 = { nounwind readnone speculatable }78  attributes #2 = { nounwind }79  80  !llvm.dbg.cu = !{!0}81  !llvm.module.flags = !{!6, !7, !8}82  !llvm.ident = !{!9}83  84  !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 9.0.0 (https://github.com/llvm/llvm-project.git 1a0312ca0b20d16edb859065bbace75f6701c92e)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)85  !1 = !DIFile(filename: "1.cpp", directory: "/mnt/c/Users/gbdawsoc/Documents/llvm/bg40969")86  !2 = !{}87  !3 = !{!4}88  !4 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !5, size: 64)89  !5 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)90  !6 = !{i32 2, !"Dwarf Version", i32 4}91  !7 = !{i32 2, !"Debug Info Version", i32 3}92  !8 = !{i32 1, !"wchar_size", i32 4}93  !9 = !{!"clang version 9.0.0 (https://github.com/llvm/llvm-project.git 1a0312ca0b20d16edb859065bbace75f6701c92e)"}94  !10 = distinct !DISubprogram(name: "bravo", linkageName: "debug", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !20)95  !11 = !DISubroutineType(types: !12)96  !12 = !{null, !13, !13}97  !13 = !DIDerivedType(tag: DW_TAG_restrict_type, baseType: !14)98  !14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !15, size: 64)99  !15 = !DIDerivedType(tag: DW_TAG_typedef, name: "alpha", file: !1, line: 2, baseType: !16)100  !16 = !DICompositeType(tag: DW_TAG_array_type, baseType: !17, size: 128, flags: DIFlagVector, elements: !18)101  !17 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)102  !18 = !{!19}103  !19 = !DISubrange(count: 4)104  !20 = !{!21, !22, !23, !24}105  !21 = !DILocalVariable(name: "p1", arg: 1, scope: !10, file: !1, line: 4, type: !13)106  !22 = !DILocalVariable(name: "p2", arg: 2, scope: !10, file: !1, line: 4, type: !13)107  !23 = !DILocalVariable(name: "p3", scope: !10, file: !1, line: 5, type: !4)108  !24 = !DILocalVariable(name: "t", scope: !25, file: !1, line: 8, type: !15)109  !25 = distinct !DILexicalBlock(scope: !26, file: !1, line: 6, column: 11)110  !26 = distinct !DILexicalBlock(scope: !10, file: !1, line: 6, column: 7)111  !27 = !DILocation(line: 0, scope: !10)112  !28 = !DILocation(line: 6, column: 7, scope: !26)113  !29 = !DILocation(line: 5, column: 14, scope: !10)114  !30 = !DILocation(line: 7, column: 9, scope: !25)115  !31 = !DILocation(line: 6, column: 7, scope: !10)116  !32 = !DILocation(line: 8, column: 15, scope: !25)117  !33 = !DILocation(line: 0, scope: !25)118  !34 = !DILocation(line: 9, column: 9, scope: !25)119  !35 = !DILocation(line: 10, column: 3, scope: !25)120  !36 = !DILocation(line: 11, column: 1, scope: !10)121 122...123---124name:            debug125alignment:       16126exposesReturnsTwice: false127legalized:       false128regBankSelected: false129selected:        false130failedISel:      false131tracksRegLiveness: true132hasWinCFI:       false133registers:       134  - { id: 0, class: gr64, preferred-register: '' }135  - { id: 1, class: gr64, preferred-register: '' }136  - { id: 2, class: vr128, preferred-register: '' }137liveins:         138  - { reg: '$rdi', virtual-reg: '%0' }139  - { reg: '$rsi', virtual-reg: '%1' }140frameInfo:       141  isFrameAddressTaken: false142  isReturnAddressTaken: false143  hasStackMap:     false144  hasPatchPoint:   false145  stackSize:       0146  offsetAdjustment: 0147  maxAlignment:    0148  adjustsStack:    false149  hasCalls:        false150  stackProtector:  ''151  maxCallFrameSize: 4294967295152  cvBytesOfCalleeSavedRegisters: 0153  hasOpaqueSPAdjustment: false154  hasVAStart:      false155  hasMustTailInVarArgFunc: false156  localFrameSize:  0157  savePoint:       []158  restorePoint:    []159fixedStack:      []160stack:           []161constants:       []162machineFunctionInfo: {}163body:             |164  bb.0.entry:165    successors: %bb.2(0x30000000), %bb.1(0x50000000)166    liveins: $rdi, $rsi167  168    DBG_VALUE $rdi, $noreg, !21, !DIExpression(), debug-location !27169    DBG_VALUE $rsi, $noreg, !22, !DIExpression(), debug-location !27170    DBG_VALUE $rdi, $noreg, !23, !DIExpression(), debug-location !27171    %1:gr64 = COPY $rsi172    DBG_VALUE %1, $noreg, !22, !DIExpression(), debug-location !27173    %0:gr64 = COPY $rdi174    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !27175    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27176    TEST64rr %0, %0, implicit-def $eflags, debug-location !28177    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27178    MOV8mi %0, 1, $noreg, 0, $noreg, 0, debug-location !30 :: (store (s8) into %ir.0)179    CFI_INSTRUCTION offset $r13, -123180    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !27181    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27182    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !27183    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27184    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !27185    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27186    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !27187    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27188    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !27189    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27190    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !27191    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27192    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !27193    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27194    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !27195    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27196    DBG_VALUE %0, $noreg, !21, !DIExpression(), debug-location !27197    DBG_VALUE %0, $noreg, !23, !DIExpression(), debug-location !27198    JCC_1 %bb.2, 4, implicit $eflags, debug-location !31199    JMP_1 %bb.1, debug-location !31200  201  bb.1.if.then:202    successors: %bb.2(0x80000000)203  204    %2:vr128 = MOVAPSrm %0, 1, $noreg, 0, $noreg, debug-location !32 :: (load (s128) from %ir.p1)205    DBG_VALUE %2, $noreg, !24, !DIExpression(), debug-location !33206    MOVAPSmr %1, 1, $noreg, 0, $noreg, killed %2, debug-location !34 :: (store (s128) into %ir.p2)207  208  bb.2.if.end:209    RET 0, debug-location !36210 211    ; CHECK-LABEL: name: debug212    ; CHECK: %3:gr8 = MOV8rm213    ; CHECK: MOV8mr214    ; CHECK: %4:gr64 = MOV64rm215    ; CHECK: MOV64mr216    ; CHECK: %5:gr32 = MOV32rm217    ; CHECK: MOV32mr218    ; CHECK: %6:gr16 = MOV16rm219    ; CHECK: MOV16mr220    ; CHECK: %7:gr8 = MOV8rm221    ; CHECK: MOV8mr222    ; CHECK: RET 0223...224