Home | History | Annotate | Download | only in Steensgaard
      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 
      6 declare noalias i8* @malloc(i64)
      7 declare noalias i8* @calloc(i64, i64)
      8 declare void @free(i8* nocapture)
      9 
     10 ; CHECK: Function: test_malloc
     11 ; CHECK: NoAlias: i8* %p, i8* %q
     12 define 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
     19 define 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
     26 define void @test_free(i8* %p) {
     27 	%q = alloca i8, align 4
     28 	call void @free(i8* %q)
     29 	ret void
     30 }
     31