[PATCH] D103009: [DSE] Eliminate memset after malloc

Dawid Jurczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 31 04:43:39 PDT 2021


yurai007 added a comment.

Regarding OutOfMemoryTest: https://github.com/llvm/llvm-project/blob/main/compiler-rt/test/fuzzer/OutOfMemoryTest.cpp failure explanation. 
Test has silent assumption that in every loop iteration we request 268MB virtual memory and get 268MB physical memory allocated. 
This is the case for malloc+memset combo (page faults trigger actual physical allocation in kernel) but not for calloc (physical memory allocation is deferred - it's faster, which is the whole point of our calloc transformation).
In consequence after my patch there is no OOM in OutOfMemoryTest so UT fails.
It can be easily fixed by saying "we _really_ want allocate and touch physical memory, not only virtual one" which end up in new volatile char[] + std::fill duo.

      


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103009/new/

https://reviews.llvm.org/D103009



More information about the llvm-commits mailing list