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
| ; RUN: opt -S -analyze -stack-safety-local < %s | FileCheck %s --check-prefixes=CHECK,LOCAL
; RUN: opt -S -passes="print<stack-safety-local>" -disable-output < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,LOCAL
; RUN: opt -S -analyze -stack-safety < %s | FileCheck %s --check-prefixes=CHECK,GLOBAL
; RUN: opt -S -passes="print-stack-safety" -disable-output < %s 2>&1 | FileCheck %s --check-prefixes=CHECK,GLOBAL
; Regression test that exercises a case when a AllocaOffsetRewritten SCEV
; could return an empty-set range. This could occur with udiv SCEVs where the
; RHS was re-written to 0.
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
declare void @ExternalFn(i64)
define void @Test1() {
; CHECK-LABEL: @Test1 dso_preemptable{{$}}
; CHECK-NEXT: args uses:
; CHECK-NEXT: allocas uses:
; LOCAL-NEXT: x[1]: empty-set, @Divide1(arg0, full-set){{$}}
; GLOBAL-NEXT: x[1]: full-set, @Divide1(arg0, full-set){{$}}
; CHECK-NOT: ]:
%x = alloca i8
%int = ptrtoint i8* %x to i64
call void @Divide1(i64 %int)
ret void
}
define dso_local void @Divide1(i64 %arg) {
; CHECK-LABEL: @Divide1{{$}}
; CHECK-NEXT: args uses:
; LOCAL-NEXT: arg[]: empty-set, @ExternalFn(arg0, full-set){{$}}
; GLOBAL-NEXT: arg[]: full-set, @ExternalFn(arg0, full-set){{$}}
; CHECK-NEXT: allocas uses:
; CHECK-NOT: ]:
%quotient = udiv i64 undef, %arg
call void @ExternalFn(i64 %quotient)
unreachable
}
define void @Test2(i64 %arg) {
; CHECK-LABEL: @Test2 dso_preemptable{{$}}
; CHECK-NEXT: args uses:
; CHECK-NEXT: arg[]: empty-set{{$}}
; CHECK-NEXT: allocas uses:
; LOCAL-NEXT: x[1]: empty-set, @Divide2(arg0, full-set){{$}}
; GLOBAL-NEXT: x[1]: full-set, @Divide2(arg0, full-set){{$}}
; CHECK-NOT: ]:
%x = alloca i8
%int = ptrtoint i8* %x to i64
call void @Divide2(i64 %int)
ret void
}
define dso_local void @Divide2(i64 %arg) {
; CHECK-LABEL: @Divide2{{$}}
; CHECK-NEXT: args uses:
; CHECK-NEXT: arg[]: full-set{{$}}
; CHECK-NEXT: allocas uses:
; CHECK-NOT: ]:
%x = inttoptr i64 %arg to i8*
%quotient = udiv i64 undef, %arg
%arrayidx = getelementptr i8, i8* %x, i64 %quotient
load i8, i8* %arrayidx
unreachable
}
|