• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; This testcase ensures that CFL AA handles malloc and free in a sound and precise manner
2
3; RUN: opt < %s -disable-basicaa -cfl-steens-aa -aa-eval -print-no-aliases -disable-output 2>&1 | FileCheck %s
4; RUN: opt < %s -aa-pipeline=cfl-steens-aa -passes=aa-eval -print-no-aliases -disable-output 2>&1 | FileCheck %s
5
6declare noalias i8* @malloc(i64)
7declare noalias i8* @calloc(i64, i64)
8declare void @free(i8* nocapture)
9
10; CHECK: Function: test_malloc
11; CHECK: NoAlias: i8* %p, i8* %q
12define void @test_malloc(i8* %p) {
13	%q = call i8* @malloc(i64 4)
14	ret void
15}
16
17; CHECK: Function: test_calloc
18; CHECK: NoAlias: i8* %p, i8* %q
19define void @test_calloc(i8* %p) {
20	%q = call i8* @calloc(i64 2, i64 4)
21	ret void
22}
23
24; CHECK: Function: test_free
25; CHECK: NoAlias: i8* %p, i8* %q
26define void @test_free(i8* %p) {
27	%q = alloca i8, align 4
28	call void @free(i8* %q)
29	ret void
30}
31