Example
define dso_local noalias i8* @_Z6maixxnv() local_unnamed_addr #0 {
entry:
%call = tail call noalias dereferenceable_or_null(64) i8* @malloc(i64 64) #6 ret i8* %call
}
Differential D66651
Annotate return values of allocation functions with dereferenceable_or_null xbolva00 on Aug 23 2019, 6:50 AM. Authored by
Details Example %call = tail call noalias dereferenceable_or_null(64) i8* @malloc(i64 64) #6 ret i8* %call }
Diff Detail
Event TimelineComment Actions I will update/add tests after some initial code review.
Comment Actions It seems inconsistent to declare Op0C initially and Op1C late given that both are need 2 times in almost the same fashion. We also need tests. I think this is the right thing to do though, dereferenceability will be used for LICM and AA (D66157), and nonnull can be eliminated with any access or null check (D65402 and following). Comment Actions I'm not an LLVM person, but I just wanted to double-check: is this correct even in the face of situations where malloc() and friends return a non-null pointer that is *not* dereferenceable? e.g., when someone calls malloc(0) with certain libc implementations? Comment Actions We ignore malloc(0), realloc(p, 0), etc cases (no annotation, deref_or_null(0) is useless). All edge cases should be coveree in deref-alloc-fns.ll. We annotate if size is known constant and > 0. Comment Actions Fixed function names in new tests. (op_new_constant_size and op_new_constant_zero_size was swapped). Comment Actions Two last comments from my side.
Comment Actions Last problem mentioned below. Otherwise, LGTM.
|
What is wrong with invoke?