brintos

brintos / llvm-project-archived public Read only

0
0
Text · 11.8 KiB · bdc9951 Raw
252 lines · plain
1; RUN: opt -S -passes=hipstdpar-interpose-alloc %s | FileCheck %s2 3%"struct.std::nothrow_t" = type { i8 }4 5@_ZSt7nothrow = external global %"struct.std::nothrow_t", align 16 7declare ptr @__hipstdpar_aligned_alloc(i64, i64)8 9declare ptr @__hipstdpar_malloc(i64)10 11declare ptr @__hipstdpar_calloc(i64, i64)12 13declare i32 @__hipstdpar_posix_aligned_alloc(ptr, i64, i64)14 15declare void @__hipstdpar_hidden_free(ptr)16 17declare ptr @__hipstdpar_hidden_malloc(i64)18 19declare ptr @__hipstdpar_hidden_memalign(i64, i64)20 21declare ptr @__hipstdpar_hidden_mmap(ptr, i64, i32, i32, i32, i64)22 23declare i32 @__hipstdpar_hidden_munmap(ptr, i64)24 25declare ptr @__hipstdpar_mmap(ptr, i64, i32, i32, i32, i64)26 27declare i32 @__hipstdpar_munmap(ptr, i64)28 29declare ptr @__hipstdpar_realloc(ptr, i64)30 31declare ptr @__hipstdpar_realloc_array(ptr, i64, i64)32 33declare void @__hipstdpar_free(ptr)34 35declare ptr @__hipstdpar_operator_new_aligned(i64, i64)36 37declare ptr @__hipstdpar_operator_new(i64)38 39declare ptr @__hipstdpar_operator_new_nothrow(i64, %"struct.std::nothrow_t")40 41declare ptr @__hipstdpar_operator_new_aligned_nothrow(i64, i64, %"struct.std::nothrow_t")42 43declare void @__hipstdpar_operator_delete_aligned_sized(ptr, i64, i64)44 45declare void @__hipstdpar_operator_delete(ptr)46 47declare void @__hipstdpar_operator_delete_aligned(ptr, i64)48 49declare void @__hipstdpar_operator_delete_sized(ptr, i64)50 51define dso_local noundef i32 @allocs() {52  ; CHECK: %1 = call noalias align 8 ptr @__hipstdpar_aligned_alloc(i64 noundef 8, i64 noundef 42)53  %1 = call noalias align 8 ptr @aligned_alloc(i64 noundef 8, i64 noundef 42)54  ; CHECK: call void @__hipstdpar_free(ptr noundef %1)55  call void @free(ptr noundef %1)56 57  ; CHECK: %2 = call noalias ptr @__hipstdpar_calloc(i64 noundef 1, i64 noundef 42)58  %2 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 42)59  ; CHECK: call void @__hipstdpar_free(ptr noundef %2)60  call void @free(ptr noundef %2)61 62  ; CHECK: %3 = call noalias ptr @__hipstdpar_malloc(i64 noundef 42)63  %3 = call noalias ptr @malloc(i64 noundef 42)64  ; CHECK: call void @__hipstdpar_free(ptr noundef %3)65  call void @free(ptr noundef %3)66 67  ; CHECK: %4 = call noalias align 8 ptr @__hipstdpar_aligned_alloc(i64 noundef 8, i64 noundef 42)68  %4 = call noalias align 8 ptr @memalign(i64 noundef 8, i64 noundef 42)69  ; CHECK: call void @__hipstdpar_free(ptr noundef %4)70  call void @free(ptr noundef %4)71 72  %tmp = alloca ptr, align 873  ; CHECK: %5 = call i32 @__hipstdpar_posix_aligned_alloc(ptr noundef %tmp, i64 noundef 8, i64 noundef 42)74  %5 = call i32 @posix_memalign(ptr noundef %tmp, i64 noundef 8, i64 noundef 42)75  ; CHECK: call void @__hipstdpar_free(ptr noundef %tmp)76  call void @free(ptr noundef %tmp)77 78  ; CHECK: %6 = call noalias ptr @__hipstdpar_malloc(i64 noundef 42)79  %6 = call noalias ptr @malloc(i64 noundef 42)80  ; CHECK: %7 = call ptr @__hipstdpar_realloc(ptr noundef %6, i64 noundef 42)81  %7 = call ptr @realloc(ptr noundef %6, i64 noundef 42)82  ; CHECK: call void @__hipstdpar_free(ptr noundef %7)83  call void @free(ptr noundef %7)84 85  ; CHECK: %8 = call noalias ptr @__hipstdpar_calloc(i64 noundef 1, i64 noundef 42)86  %8 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 42)87  ; CHECK: %9 = call ptr @__hipstdpar_realloc_array(ptr noundef %8, i64 noundef 1, i64 noundef 42)88  %9 = call ptr @reallocarray(ptr noundef %8, i64 noundef 1, i64 noundef 42)89  ; CHECK: call void @__hipstdpar_free(ptr noundef %9)90  call void @free(ptr noundef %9)91 92  ; CHECK: %10 = call noalias noundef nonnull ptr @__hipstdpar_operator_new(i64 noundef 1)93  %10 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 1)94  ; CHECK: call void @__hipstdpar_operator_delete(ptr noundef %10)95  call void @_ZdlPv(ptr noundef %10)96 97  ; CHECK: %11 = call noalias noundef nonnull align 8 ptr @__hipstdpar_operator_new_aligned(i64 noundef 1, i64 noundef 8)98  %11 = call noalias noundef nonnull align 8 ptr @_ZnwmSt11align_val_t(i64 noundef 1, i64 noundef 8)99  ; CHECK: call void @__hipstdpar_operator_delete_aligned(ptr noundef %11, i64 noundef 8)100  call void @_ZdlPvSt11align_val_t(ptr noundef %11, i64 noundef 8)101 102  ; CHECK: %12 = call noalias noundef ptr @__hipstdpar_operator_new_nothrow(i64 noundef 1, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)103  %12 = call noalias noundef ptr @_ZnwmRKSt9nothrow_t(i64 noundef 1, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)104  ; CHECK: call void @__hipstdpar_operator_delete(ptr noundef %12)105  call void @_ZdlPv(ptr noundef %12)106 107  ; CHECK: %13 = call noalias noundef align 8 ptr @__hipstdpar_operator_new_aligned_nothrow(i64 noundef 1, i64 noundef 8, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)108  %13 = call noalias noundef align 8 ptr @_ZnwmSt11align_val_tRKSt9nothrow_t(i64 noundef 1, i64 noundef 8, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)109  ; CHECK: call void @__hipstdpar_operator_delete_aligned(ptr noundef %13, i64 noundef 8)110  call void @_ZdlPvSt11align_val_t(ptr noundef %13, i64 noundef 8)111 112  ; CHECK: %14 = call noalias noundef nonnull ptr @__hipstdpar_operator_new(i64 noundef 42)113  %14 = call noalias noundef nonnull ptr @_Znam(i64 noundef 42)114  ; CHECK: call void @__hipstdpar_operator_delete(ptr noundef %14)115  call void @_ZdaPv(ptr noundef %14)116 117  ; CHECK: %15 = call noalias noundef nonnull align 8 ptr @__hipstdpar_operator_new_aligned(i64 noundef 42, i64 noundef 8)118  %15 = call noalias noundef nonnull align 8 ptr @_ZnamSt11align_val_t(i64 noundef 42, i64 noundef 8)119  ; CHECK: call void @__hipstdpar_operator_delete_aligned(ptr noundef %15, i64 noundef 8)120  call void @_ZdaPvSt11align_val_t(ptr noundef %15, i64 noundef 8)121 122  ; CHECK:  %16 = call noalias noundef ptr @__hipstdpar_operator_new_nothrow(i64 noundef 42, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)123  %16 = call noalias noundef ptr @_ZnamRKSt9nothrow_t(i64 noundef 42, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)124  ; CHECK: call void @__hipstdpar_operator_delete(ptr noundef %16)125  call void @_ZdaPv(ptr noundef %16)126 127  ; CHECK: %17 = call noalias noundef align 8 ptr @__hipstdpar_operator_new_aligned_nothrow(i64 noundef 42, i64 noundef 8, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)128  %17 = call noalias noundef align 8 ptr @_ZnamSt11align_val_tRKSt9nothrow_t(i64 noundef 42, i64 noundef 8, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)129  ; CHECK: call void @__hipstdpar_operator_delete_aligned(ptr noundef %17, i64 noundef 8)130  call void @_ZdaPvSt11align_val_t(ptr noundef %17, i64 noundef 8)131 132  ; CHECK:  %18 = call ptr @__hipstdpar_calloc(i64 noundef 1, i64 noundef 42)133  %18 = call ptr @calloc(i64 noundef 1, i64 noundef 42)134  ; CHECK: call void @__hipstdpar_free(ptr noundef %18)135  call void @free(ptr noundef %18)136 137  ; CHECK: %19 = call ptr @__hipstdpar_malloc(i64 noundef 42)138  %19 = call ptr @malloc(i64 noundef 42)139  ; CHECK: call void @__hipstdpar_free(ptr noundef %19)140  call void @free(ptr noundef %19)141 142  ; CHECK: %20 = call noalias noundef nonnull ptr @__hipstdpar_operator_new(i64 noundef 42)143  %20 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 42)144  ; CHECK: call void @__hipstdpar_operator_delete(ptr noundef %20)145  call void @_ZdlPv(ptr noundef %20)146 147  ; CHECK:  %21 = call noalias noundef nonnull align 8 ptr @__hipstdpar_operator_new_aligned(i64 noundef 42, i64 noundef 8)148  %21 = call noalias noundef nonnull align 8 ptr @_ZnwmSt11align_val_t(i64 noundef 42, i64 noundef 8)149  ; CHECK: call void @__hipstdpar_operator_delete_aligned(ptr noundef %21, i64 noundef 8)150  call void @_ZdlPvSt11align_val_t(ptr noundef %21, i64 noundef 8)151 152  ; CHECK: %22 = call noalias noundef ptr @__hipstdpar_operator_new_nothrow(i64 noundef 42, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)153  %22 = call noalias noundef ptr @_ZnwmRKSt9nothrow_t(i64 noundef 42, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)154  ; CHECK: call void @__hipstdpar_operator_delete(ptr noundef %22)155  call void @_ZdlPv(ptr noundef %22)156 157  ; CHECK:  %23 = call noalias noundef align 8 ptr @__hipstdpar_operator_new_aligned_nothrow(i64 noundef 42, i64 noundef 8, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)158  %23 = call noalias noundef align 8 ptr @_ZnwmSt11align_val_tRKSt9nothrow_t(i64 noundef 42, i64 noundef 8, ptr noundef nonnull align 1 dereferenceable(1) @_ZSt7nothrow)159  ; CHECK: call void @__hipstdpar_operator_delete_aligned(ptr noundef %23, i64 noundef 8)160  call void @_ZdlPvSt11align_val_t(ptr noundef %23, i64 noundef 8)161 162  ; CHECK: %24 = call ptr @__hipstdpar_malloc(i64 noundef 42)163  %24 = call ptr @malloc(i64 noundef 42)164  ; CHECK: %25 = call ptr @__hipstdpar_realloc(ptr noundef %24, i64 noundef 41)165  %25 = call ptr @realloc(ptr noundef %24, i64 noundef 41)166  ; CHECK: call void @__hipstdpar_free(ptr noundef %25)167  call void @free(ptr noundef %25)168 169  ; CHECK: %26 = call ptr @__hipstdpar_calloc(i64 noundef 1, i64 noundef 42)170  %26 = call ptr @__libc_calloc(i64 noundef 1, i64 noundef 42)171  ; CHECK: call void @__hipstdpar_free(ptr noundef %26)172  call void @__libc_free(ptr noundef %26)173 174  ; CHECK: %27 = call ptr @__hipstdpar_malloc(i64 noundef 42)175  %27 = call ptr @__libc_malloc(i64 noundef 42)176  ; CHECK: call void @__hipstdpar_free(ptr noundef %27)177  call void @__libc_free(ptr noundef %27)178 179  ; CHECK: %28 = call ptr @__hipstdpar_aligned_alloc(i64 noundef 8, i64 noundef 42)180  %28 = call ptr @__libc_memalign(i64 noundef 8, i64 noundef 42)181  ; CHECK: call void @__hipstdpar_free(ptr noundef %28)182  call void @__libc_free(ptr noundef %28)183 184  ; CHECK: %29 = call ptr @__libc_malloc(i64 noundef 8)185  %29 = call ptr @__hipstdpar_hidden_malloc(i64 noundef 8)186  ; CHECK: call void @__libc_free(ptr noundef %29)187  call void @__hipstdpar_hidden_free(ptr noundef %29)188 189  ; CHECK: %30 = call ptr @__libc_memalign(i64 noundef 8, i64 noundef 4)190  %30 = call ptr @__hipstdpar_hidden_memalign(i64 noundef 8, i64 noundef 4)191  ; CHECK: %31 = call ptr @mmap(ptr %30, i64 8, i32 0, i32 0, i32 0, i64 0)192  %31 = call ptr @__hipstdpar_hidden_mmap(ptr %30, i64 8, i32 0, i32 0, i32 0, i64 0)193  ; CHECK: %32 = call i32 @munmap(ptr %31, i64 8)194  %32 = call i32 @__hipstdpar_hidden_munmap(ptr %31, i64 8)195  ; CHECK: call void @__libc_free(ptr noundef %30)196  call void @__hipstdpar_hidden_free(ptr noundef %30)197 198  ret i32 %32199}200 201declare noalias ptr @aligned_alloc(i64 noundef, i64 noundef)202 203declare void @free(ptr noundef)204 205declare noalias ptr @calloc(i64 noundef, i64 noundef)206 207declare noalias ptr @malloc(i64 noundef)208 209declare noalias ptr @memalign(i64 noundef, i64 noundef)210 211declare i32 @posix_memalign(ptr noundef, i64 noundef, i64 noundef)212 213declare ptr @realloc(ptr noundef, i64 noundef)214 215declare ptr @reallocarray(ptr noundef, i64 noundef, i64 noundef)216 217declare noundef nonnull ptr @_Znwm(i64 noundef)218 219declare void @_ZdlPv(ptr noundef)220 221declare noalias noundef nonnull ptr @_ZnwmSt11align_val_t(i64 noundef, i64 noundef)222 223declare void @_ZdlPvSt11align_val_t(ptr noundef, i64 noundef)224 225declare noalias noundef ptr @_ZnwmRKSt9nothrow_t(i64 noundef, ptr noundef nonnull align 1 dereferenceable(1))226 227declare noalias noundef ptr @_ZnwmSt11align_val_tRKSt9nothrow_t(i64 noundef, i64 noundef, ptr noundef nonnull align 1 dereferenceable(1))228 229declare noundef nonnull ptr @_Znam(i64 noundef)230 231declare void @_ZdaPv(ptr noundef)232 233declare noalias noundef nonnull ptr @_ZnamSt11align_val_t(i64 noundef, i64 noundef)234 235declare void @_ZdaPvSt11align_val_t(ptr noundef, i64 noundef)236 237declare noalias noundef ptr @_ZnamRKSt9nothrow_t(i64 noundef, ptr noundef nonnull align 1 dereferenceable(1))238 239declare noalias noundef ptr @_ZnamSt11align_val_tRKSt9nothrow_t(i64 noundef, i64 noundef, ptr noundef nonnull align 1 dereferenceable(1))240 241declare ptr @__libc_calloc(i64 noundef, i64 noundef)242 243declare void @__libc_free(ptr noundef)244 245declare ptr @__libc_malloc(i64 noundef)246 247declare ptr @__libc_memalign(i64 noundef, i64 noundef)248 249declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef)250 251declare i32 @munmap(ptr noundef, i64 noundef)252