aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/Transforms/SimplifyCFG/pr165301.ll
blob: 1df655250f57e1fcd65e95d91754ed9d1eb8867e (plain)
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
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals all --version 6
; RUN: opt -S -passes="simplifycfg<switch-range-to-icmp>" < %s | FileCheck %s

; Make sure there's no use after free when removing incoming values from PHI nodes

define i32 @pr165301(i1 %cond) !prof !0 {
; CHECK-LABEL: define i32 @pr165301(
; CHECK-SAME: i1 [[COND:%.*]]) !prof [[PROF0:![0-9]+]] {
; CHECK-NEXT:  [[ENTRY:.*:]]
; CHECK-NEXT:    br label %[[SWITCHBB:.*]]
; CHECK:       [[SWITCHBB]]:
; CHECK-NEXT:    br label %[[SWITCHBB]]
;
entry:
  br label %switchbb

switchbb:
  switch i1 %cond, label %default [
  i1 false, label %switchbb
  i1 true, label %switchbb
  ], !prof !1

default:
  %phi.lcssa = phi i32 [ 0, %switchbb ]
  ret i32 %phi.lcssa
}
!0 = !{!"function_entry_count", i32 10}
!1 = !{!"branch_weights", i32 2, i32 3, i32 5}
;.
; CHECK: [[PROF0]] = !{!"function_entry_count", i32 10}
;.