File: stale-worklist-phi.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (47 lines) | stat: -rw-r--r-- 1,759 bytes parent folder | download | duplicates (6)
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
; RUN: opt -passes=lower-constant-intrinsics -S < %s | FileCheck %s

; This is a reproducer for a heap-use-after-free bug that occurred due to trying
; to process a PHI node that was removed in a preceding worklist iteration. The
; conditional branch in %cont2.i will be replaced with an unconditional branch
; to %cont4.i. As a result of that, the PHI node in %handler.type_mismatch3.i
; will be left with one predecessor and will thus be removed in that iteration.

; CHECK-NOT: phi
; CHECK: cont2.i:
; CHECK-NEXT: br label %cont4.i
; CHECK-NOT: phi

%s = type { [2 x i16] }

define fastcc void @foo(ptr %p, i1 %arg) unnamed_addr {
entry:
  %0 = tail call i32 @llvm.objectsize.i32.p0(ptr %p, i1 false, i1 false, i1 false) #2
  %1 = icmp ne i32 %0, 0
  %.not1.i = icmp eq i32 %0, 0
  br label %for.cond

for.cond:                                         ; preds = %entry
  br label %cont.i

cont.i:                                           ; preds = %for.cond
  br i1 %arg, label %cont2.i, label %cont2.thread.i

cont2.thread.i:                                   ; preds = %cont.i
  br label %handler.type_mismatch3.i

cont2.i:                                          ; preds = %cont.i
  br i1 %.not1.i, label %handler.type_mismatch3.i, label %cont4.i

handler.type_mismatch3.i:                         ; preds = %cont2.i, %cont2.thread.i
  %2 = phi i1 [ %1, %cont2.thread.i ], [ false, %cont2.i ]
  unreachable

cont4.i:                                          ; preds = %cont2.i
  unreachable
}

; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare i32 @llvm.objectsize.i32.p0(ptr, i1 immarg, i1 immarg, i1 immarg) #1

attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
attributes #2 = { nounwind }