reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
# RUN: llc -O2 -o - %s -mtriple=aarch64-windows -start-before=shrink-wrap \
# RUN:   -stop-after=prologepilog | FileCheck %s --check-prefix=WIN64
# RUN: llc -O2 -o - %s -mtriple=aarch64-linux -start-before=shrink-wrap \
# RUN:   -stop-after=prologepilog | FileCheck %s --check-prefix=LINUX

# This tests checks that shrink wrapping bails out on Windows AMR64 due to the
# use of Windows CFI.  We don't currently support fragments for WIndows EH on
# ARM64.
# The same test gets shrink wrapped on Linux ARM64.

# WIN64-LABEL: bb.0.entry:
# WIN64: early-clobber $sp = frame-setup STPXpre killed $fp, killed $lr, $sp, -4
# WIN64-LABEL: bb.1:
# WIN64-LABEL: bb.2.if.then:

# LINUX-LABEL: bb.0.entry:
# LINUX-LABEL: bb.1:
# LINUX-LABEL: bb.2.if.then:
# LINUX: early-clobber $sp = frame-setup STRXpre killed $fp, $sp, -32
--- |
  ; ModuleID = 'shrink.cpp'
  target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
  target triple = "aarch64-unknown-windows-msvc19.11.0"

  define dso_local i32 @"?func@@YAHHH@Z"(i32 %a, i32 %b) local_unnamed_addr #0 {
  entry:
    %A = alloca [1000 x i32], align 4
    %cmp = icmp sgt i32 %a, 1
    br i1 %cmp, label %if.then, label %return

  if.then:                                          ; preds = %entry
    %0 = bitcast [1000 x i32]* %A to i8*
    call void @llvm.lifetime.start.p0i8(i64 4000, i8* nonnull %0) #3
    %arraydecay2 = bitcast [1000 x i32]* %A to i32*
    call void @"?init@@YAXPEAH@Z"(i32* nonnull %arraydecay2)
    %arrayidx = getelementptr inbounds [1000 x i32], [1000 x i32]* %A, i64 0, i64 100
    %1 = load i32, i32* %arrayidx, align 4, !tbaa !2
    %add = add i32 %b, 1
    %add1 = add i32 %add, %1
    call void @llvm.lifetime.end.p0i8(i64 4000, i8* nonnull %0) #3
    br label %return

  return:                                           ; preds = %entry, %if.then
    %retval.0 = phi i32 [ %add1, %if.then ], [ 0, %entry ]
    ret i32 %retval.0
  }

  ; Function Attrs: argmemonly nounwind
  declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1

  declare dso_local void @"?init@@YAXPEAH@Z"(i32*) local_unnamed_addr #2

  ; Function Attrs: argmemonly nounwind
  declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1

  ; Function Attrs: nounwind
  declare void @llvm.stackprotector(i8*, i8**) #3

  attributes #0 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "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"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }
  attributes #1 = { argmemonly nounwind }
  attributes #2 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon" "unsafe-fp-math"="false" "use-soft-float"="false" }
  attributes #3 = { nounwind }

  !llvm.module.flags = !{!0}
  !llvm.ident = !{!1}

  !0 = !{i32 1, !"wchar_size", i32 2}
  !1 = !{!"clang version 8.0.0"}
  !2 = !{!3, !3, i64 0}
  !3 = !{!"int", !4, i64 0}
  !4 = !{!"omnipotent char", !5, i64 0}
  !5 = !{!"Simple C++ TBAA"}

...
---
name:            '?func@@YAHHH@Z'
alignment:       4
exposesReturnsTwice: false
legalized:       false
regBankSelected: false
selected:        false
failedISel:      false
tracksRegLiveness: true
registers:
liveins:
  - { reg: '$w0', virtual-reg: '' }
  - { reg: '$w1', virtual-reg: '' }
frameInfo:
  isFrameAddressTaken: false
  isReturnAddressTaken: false
  hasStackMap:     false
  hasPatchPoint:   false
  stackSize:       0
  offsetAdjustment: 0
  maxAlignment:    4
  adjustsStack:    true
  hasCalls:        true
  stackProtector:  ''
  maxCallFrameSize: 0
  cvBytesOfCalleeSavedRegisters: 0
  hasOpaqueSPAdjustment: false
  hasVAStart:      false
  hasMustTailInVarArgFunc: false
  localFrameSize:  4000
  savePoint:       ''
  restorePoint:    ''
fixedStack:
stack:
  - { id: 0, name: A, type: default, offset: 0, size: 4000, alignment: 4,
      stack-id: default, callee-saved-register: '', callee-saved-restored: true,
      local-offset: -4000, debug-info-variable: '', debug-info-expression: '',
      debug-info-location: '' }
constants:
body:             |
  bb.0.entry:
    successors: %bb.2(0x40000000), %bb.1(0x40000000)
    liveins: $w0, $w1

    dead $wzr = SUBSWri killed renamable $w0, 2, 0, implicit-def $nzcv
    Bcc 10, %bb.2, implicit killed $nzcv

  bb.1:
    successors: %bb.3(0x80000000)

    renamable $w0 = COPY $wzr
    B %bb.3

  bb.2.if.then:
    successors: %bb.3(0x80000000)
    liveins: $w1

    renamable $w19 = COPY $w1
    ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
    $x0 = ADDXri %stack.0.A, 0, 0
    BL @"?init@@YAXPEAH@Z", csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $x0, implicit-def $sp
    ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
    renamable $w8 = LDRWui %stack.0.A, 100 :: (dereferenceable load 4 from %ir.arrayidx, !tbaa !2)
    renamable $w8 = ADDWrr killed renamable $w19, killed renamable $w8
    renamable $w0 = ADDWri killed renamable $w8, 1, 0

  bb.3.return:
    liveins: $w0

    RET_ReallyLR implicit $w0

...