File: duplicate-phi-preds-crash.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (54 lines) | stat: -rw-r--r-- 1,812 bytes parent folder | download | duplicates (14)
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
; RUN: opt -S -passes=hotcoldsplit -hotcoldsplit-threshold=0 < %s | FileCheck %s

target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.14.0"

declare void @sideeffect(i64)

declare ptr @realloc(ptr %ptr, i64 %size)

declare void @free(ptr %ptr)

declare void @sink() cold

; CHECK-LABEL: define {{.*}}@realloc2(
; CHECK: call {{.*}}@sideeffect(
; CHECK: call {{.*}}@realloc(
; CHECK-LABEL: codeRepl:
; CHECK: call {{.*}}@realloc2.cold.1(i64 %size, ptr %ptr, ptr %retval.0.ce.loc)
; CHECK-LABEL: cleanup:
; CHECK-NEXT: phi ptr [ null, %if.then ], [ %call, %if.end ], [ %retval.0.ce.reload, %codeRepl ]
define ptr @realloc2(ptr %ptr, i64 %size) {
entry:
  %0 = add i64 %size, -1
  %1 = icmp ugt i64 %0, 184549375
  br i1 %1, label %if.then, label %if.end

if.then:                                          ; preds = %entry
  call void @sideeffect(i64 %size)
  br label %cleanup

if.end:                                           ; preds = %entry
  %call = call ptr @realloc(ptr %ptr, i64 %size)
  %tobool1 = icmp eq ptr %call, null
  br i1 %tobool1, label %if.then2, label %cleanup

if.then2:                                         ; preds = %if.end
  call void @sideeffect(i64 %size)
  call void @sink()
  %tobool3 = icmp eq ptr %ptr, null
  br i1 %tobool3, label %cleanup, label %if.then4

if.then4:                                         ; preds = %if.then2
  call void @free(ptr %ptr)
  br label %cleanup

cleanup:                                          ; preds = %if.end, %if.then4, %if.then2, %if.then
  %retval.0 = phi ptr [ null, %if.then ], [ null, %if.then2 ], [ null, %if.then4 ], [ %call, %if.end ]
  ret ptr %retval.0
}

; CHECK-LABEL: define {{.*}}@realloc2.cold.1(
; CHECK: call {{.*}}@sideeffect
; CHECK: call {{.*}}@sink
; CHECK: call {{.*}}@free