xref: /llvm-project/llvm/test/Analysis/ScalarEvolution/malloc.ll (revision 88f7dc17eb271e37caf381f02eb75b3493e2b4a5)
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 2
2; RUN: opt -passes='print<scalar-evolution>' -disable-output %s 2>&1 | FileCheck %s
3
4define ptr @f() {
5; CHECK-LABEL: 'f'
6; CHECK-NEXT:  Classifying expressions for: @f
7; CHECK-NEXT:    %alloc = tail call dereferenceable(64) ptr @malloc(i64 64)
8; CHECK-NEXT:    --> %alloc U: [1,-64) S: full-set
9; CHECK-NEXT:  Determining loop execution counts for: @f
10;
11  %alloc = tail call dereferenceable(64) ptr @malloc(i64 64)
12  ret ptr %alloc
13}
14
15define ptr @f2() {
16; CHECK-LABEL: 'f2'
17; CHECK-NEXT:  Classifying expressions for: @f2
18; CHECK-NEXT:    %alloc = tail call dereferenceable_or_null(64) ptr @malloc(i64 64)
19; CHECK-NEXT:    --> %alloc U: [0,-64) S: full-set
20; CHECK-NEXT:  Determining loop execution counts for: @f2
21;
22  %alloc = tail call dereferenceable_or_null(64) ptr @malloc(i64 64)
23  ret ptr %alloc
24}
25
26define ptr @undefined_max() {
27; CHECK-LABEL: 'undefined_max'
28; CHECK-NEXT:  Classifying expressions for: @undefined_max
29; CHECK-NEXT:    %alloc = call nonnull ptr @malloc(i64 -1)
30; CHECK-NEXT:    --> %alloc U: full-set S: full-set
31; CHECK-NEXT:  Determining loop execution counts for: @undefined_max
32;
33  %alloc = call nonnull ptr @malloc(i64 -1)
34  ret ptr %alloc
35}
36
37declare noalias noundef ptr @malloc(i64 noundef) allockind("alloc,uninitialized") allocsize(0)
38