This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP] Add OpenMP 5.1 omp_realloc function implementation
ClosedPublic

Authored by Nawrin on Nov 6 2020, 1:45 PM.

Diff Detail

Event Timeline

Nawrin created this revision.Nov 6 2020, 1:45 PM
Nawrin requested review of this revision.Nov 6 2020, 1:45 PM

Can we have tests for ptr = NULL, size=0? Probably just replace alloc and free by these cases and check returned address after each call?

openmp/runtime/src/kmp_alloc.cpp
1589

Shouldn't this be after handling size==0?

Can we have tests for ptr = NULL, size=0? Probably just replace alloc and free by these cases and check returned address after each call?

Nice suggestion, agree with it.

openmp/runtime/src/kmp_alloc.cpp
1589

Actually, the assertion does not make sense at all, because size_t is unsigned.

Nawrin updated this revision to Diff 305251.Nov 13 2020, 1:36 PM

Added new tests and remove debug assert

Please also change the openmp/runtime/tools/generate-def.pl file in order to not break Windows build.
See https://reviews.llvm.org/D91478 as an example of the change made for omp_calloc function.

Nawrin updated this revision to Diff 305540.Nov 16 2020, 9:23 AM

Added fix for windows build

protze.joachim added a comment.EditedNov 17 2020, 3:53 AM

The tests have the same format type issue as in D90967. Feel free to include the fixes for the calloc tests in this review.

PS: this summary does not show the inline code suggestions. They are only inline below :(

openmp/runtime/test/api/omp_realloc_def_fb.c
20–21
openmp/runtime/test/api/omp_realloc_null_ptr.c
21–22
openmp/runtime/test/api/omp_realloc_size_0.c
21–22
Nawrin updated this revision to Diff 305822.Nov 17 2020, 9:11 AM

Fix test errors for both realloc and calloc implementation.

This revision is now accepted and ready to land.Nov 17 2020, 11:15 AM
This revision was automatically updated to reflect the committed changes.