[PATCH] D47345: [InstructionCombing] Replace small allocations with local/global variable

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 24 14:02:57 PDT 2018


xbolva00 created this revision.
Herald added a subscriber: llvm-commits.

Requires constant size to be allocated

nt main(void) {

  char *ptr = malloc(8000000 * sizeof(char)); // SIZE
  
  strcpy(ptr, "test");
  puts(ptr);
  
  free(ptr);

}

if SIZE < threshold (currently 256)

  -> create something like "char ptr[size]"

else

  -> create global variable 

Fires 56x in MultiSource benchmark.

Tests would be added later, after an initial discussion.


Repository:
  rL LLVM

https://reviews.llvm.org/D47345

Files:
  lib/Transforms/InstCombine/InstCombineInternal.h
  lib/Transforms/InstCombine/InstructionCombining.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47345.148479.patch
Type: text/x-patch
Size: 3872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180524/9877ac09/attachment.bin>


More information about the llvm-commits mailing list