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
  147
  148
  149
  150
  151
  152
  153
  154
  155
; RUN: opt -basicaa -print-memoryssa -verify-memoryssa -analyze < %s 2>&1 | FileCheck %s
; RUN: opt -aa-pipeline=basic-aa -passes='print<memoryssa>,verify<memoryssa>' -disable-output < %s 2>&1 | FileCheck %s

%struct.hoge = type { i32, %struct.widget }
%struct.widget = type { i64 }

define hidden void @quux(%struct.hoge *%f) align 2 {
  %tmp = getelementptr inbounds %struct.hoge, %struct.hoge* %f, i64 0, i32 1, i32 0
  %tmp24 = getelementptr inbounds %struct.hoge, %struct.hoge* %f, i64 0, i32 1
  %tmp25 = bitcast %struct.widget* %tmp24 to i64**
  br label %bb26

bb26:                                             ; preds = %bb77, %0
; CHECK:  3 = MemoryPhi({%0,liveOnEntry},{bb77,2})
; CHECK-NEXT:   br i1 undef, label %bb68, label %bb77
  br i1 undef, label %bb68, label %bb77

bb68:                                             ; preds = %bb26
; CHECK:  MemoryUse(liveOnEntry)
; CHECK-NEXT:   %tmp69 = load i64, i64* null, align 8
  %tmp69 = load i64, i64* null, align 8
; CHECK:  1 = MemoryDef(3)
; CHECK-NEXT:   store i64 %tmp69, i64* %tmp, align 8
  store i64 %tmp69, i64* %tmp, align 8
  br label %bb77

bb77:                                             ; preds = %bb68, %bb26
; CHECK:  2 = MemoryPhi({bb26,3},{bb68,1})
; CHECK:  MemoryUse(2)
; CHECK-NEXT:   %tmp78 = load i64*, i64** %tmp25, align 8
  %tmp78 = load i64*, i64** %tmp25, align 8
  %tmp79 = getelementptr inbounds i64, i64* %tmp78, i64 undef
  br label %bb26
}

define hidden void @quux_no_null_opt(%struct.hoge *%f) align 2 #0 {
; CHECK-LABEL: quux_no_null_opt(
  %tmp = getelementptr inbounds %struct.hoge, %struct.hoge* %f, i64 0, i32 1, i32 0
  %tmp24 = getelementptr inbounds %struct.hoge, %struct.hoge* %f, i64 0, i32 1
  %tmp25 = bitcast %struct.widget* %tmp24 to i64**
  br label %bb26

bb26:                                             ; preds = %bb77, %0
; CHECK:  3 = MemoryPhi({%0,liveOnEntry},{bb77,2})
; CHECK-NEXT:   br i1 undef, label %bb68, label %bb77
  br i1 undef, label %bb68, label %bb77

bb68:                                             ; preds = %bb26
; CHECK:  MemoryUse(3)
; CHECK-NEXT:   %tmp69 = load i64, i64* null, align 8
  %tmp69 = load i64, i64* null, align 8
; CHECK:  1 = MemoryDef(3)
; CHECK-NEXT:   store i64 %tmp69, i64* %tmp, align 8
  store i64 %tmp69, i64* %tmp, align 8
  br label %bb77

bb77:                                             ; preds = %bb68, %bb26
; CHECK:  2 = MemoryPhi({bb26,3},{bb68,1})
; CHECK:  MemoryUse(2)
; CHECK-NEXT:   %tmp78 = load i64*, i64** %tmp25, align 8
  %tmp78 = load i64*, i64** %tmp25, align 8
  %tmp79 = getelementptr inbounds i64, i64* %tmp78, i64 undef
  br label %bb26
}

; CHECK-LABEL: define void @quux_skip
define void @quux_skip(%struct.hoge* noalias %f, i64* noalias %g) align 2 {
  %tmp = getelementptr inbounds %struct.hoge, %struct.hoge* %f, i64 0, i32 1, i32 0
  %tmp24 = getelementptr inbounds %struct.hoge, %struct.hoge* %f, i64 0, i32 1
  %tmp25 = bitcast %struct.widget* %tmp24 to i64**
  br label %bb26

bb26:                                             ; preds = %bb77, %0
; CHECK: 3 = MemoryPhi({%0,liveOnEntry},{bb77,2})
; CHECK-NEXT: br i1 undef, label %bb68, label %bb77
  br i1 undef, label %bb68, label %bb77

bb68:                                             ; preds = %bb26
; CHECK: MemoryUse(3)
; CHECK-NEXT: %tmp69 = load i64, i64* %g, align 8
  %tmp69 = load i64, i64* %g, align 8
; CHECK: 1 = MemoryDef(3)
; CHECK-NEXT: store i64 %tmp69, i64* %g, align 8
  store i64 %tmp69, i64* %g, align 8
  br label %bb77

bb77:                                             ; preds = %bb68, %bb26
; CHECK: 2 = MemoryPhi({bb26,3},{bb68,1})
; CHECK: MemoryUse(liveOnEntry)
; CHECK-NEXT: %tmp78 = load i64*, i64** %tmp25, align 8
  %tmp78 = load i64*, i64** %tmp25, align 8
  br label %bb26
}

; CHECK-LABEL: define void @quux_dominated
define void @quux_dominated(%struct.hoge* noalias %f, i64* noalias %g) align 2 {
  %tmp = getelementptr inbounds %struct.hoge, %struct.hoge* %f, i64 0, i32 1, i32 0
  %tmp24 = getelementptr inbounds %struct.hoge, %struct.hoge* %f, i64 0, i32 1
  %tmp25 = bitcast %struct.widget* %tmp24 to i64**
  br label %bb26

bb26:                                             ; preds = %bb77, %0
; CHECK: 3 = MemoryPhi({%0,liveOnEntry},{bb77,2})
; CHECK: MemoryUse(3)
; CHECK-NEXT: load i64*, i64** %tmp25, align 8
  load i64*, i64** %tmp25, align 8
  br i1 undef, label %bb68, label %bb77

bb68:                                             ; preds = %bb26
; CHECK: MemoryUse(3)
; CHECK-NEXT: %tmp69 = load i64, i64* %g, align 8
  %tmp69 = load i64, i64* %g, align 8
; CHECK: 1 = MemoryDef(3)
; CHECK-NEXT: store i64 %tmp69, i64* %g, align 8
  store i64 %tmp69, i64* %g, align 8
  br label %bb77

bb77:                                             ; preds = %bb68, %bb26
; CHECK: 4 = MemoryPhi({bb26,3},{bb68,1})
; CHECK: 2 = MemoryDef(4)
; CHECK-NEXT: store i64* null, i64** %tmp25, align 8
  store i64* null, i64** %tmp25, align 8
  br label %bb26
}

; CHECK-LABEL: define void @quux_nodominate
define void @quux_nodominate(%struct.hoge* noalias %f, i64* noalias %g) align 2 {
  %tmp = getelementptr inbounds %struct.hoge, %struct.hoge* %f, i64 0, i32 1, i32 0
  %tmp24 = getelementptr inbounds %struct.hoge, %struct.hoge* %f, i64 0, i32 1
  %tmp25 = bitcast %struct.widget* %tmp24 to i64**
  br label %bb26

bb26:                                             ; preds = %bb77, %0
; CHECK: 3 = MemoryPhi({%0,liveOnEntry},{bb77,2})
; CHECK: MemoryUse(liveOnEntry)
; CHECK-NEXT: load i64*, i64** %tmp25, align 8
  load i64*, i64** %tmp25, align 8
  br i1 undef, label %bb68, label %bb77

bb68:                                             ; preds = %bb26
; CHECK: MemoryUse(3)
; CHECK-NEXT: %tmp69 = load i64, i64* %g, align 8
  %tmp69 = load i64, i64* %g, align 8
; CHECK: 1 = MemoryDef(3)
; CHECK-NEXT: store i64 %tmp69, i64* %g, align 8
  store i64 %tmp69, i64* %g, align 8
  br label %bb77

bb77:                                             ; preds = %bb68, %bb26
; CHECK: 2 = MemoryPhi({bb26,3},{bb68,1})
; CHECK-NEXT: br label %bb26
  br label %bb26
}

attributes #0 = { "null-pointer-is-valid"="true" }