[PATCH] D47345: [InstructionCombining] Replace small heap allocations with local variables

Dávid Bolvanský via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 2 11:40:38 PDT 2018


xbolva00 added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:2276
 
+bool InstCombiner::eliminateSmallAllocations(Value *Op, CallInst &FI) {
+  Function *F = FI.getFunction();
----------------
Or maybe we can turn larger allocations into global variables also? + allocations with unknown (not constant) size?


================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:2294
+
+  bool FoundFree = false;
+  for (User *I : Malloc->users()) {
----------------
this looks bad, any advice how to do it properly?

Maybe just remove all free calls in Malloc's uses?


https://reviews.llvm.org/D47345





More information about the llvm-commits mailing list