[PATCH] D35035: [InstCombine] Prevent memcpy generation for small data size

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 30 10:19:50 PDT 2018


lebedev.ri added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:133
   assert(Size && "0-sized memory transferring should be removed already.");
 
+  // Since we don't have perfect knowledge here, make some assumptions: assume
----------------
You can check that the `Size` is power of two here.


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:139-140
+
+  if (LargestInt == 0)
+    LargestInt = 32;
+ 
----------------
I think we decided that the tests should be updated instead?


================
Comment at: lib/Transforms/InstCombine/InstCombineCalls.cpp:142
+ 
+  if (!LargestInt || Size > LargestInt || (Size&(Size-1)))
+    return nullptr;
----------------
You overrode LargestInt already, it can't be `0`.
This should only be `Size > LargestInt`.


https://reviews.llvm.org/D35035





More information about the llvm-commits mailing list