[PATCH] D40723: [MemCpyOpt] Perform call slot optimizations through GEPs

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 11:05:11 PST 2017


hfinkel added inline comments.


================
Comment at: lib/IR/Value.cpp:661
   } else if (auto *AI = dyn_cast<AllocaInst>(this)) {
-    if (AI->getAllocatedType()->isSized()) {
-      DerefBytes = DL.getTypeStoreSize(AI->getAllocatedType());
+    const ConstantInt *arraySize = dyn_cast<ConstantInt>(AI->getArraySize());
+    if (arraySize && AI->getAllocatedType()->isSized()) {
----------------
arraySize -> ArraySize


================
Comment at: lib/IR/Value.cpp:663
+    if (arraySize && AI->getAllocatedType()->isSized()) {
+      DerefBytes = DL.getTypeStoreSize(AI->getAllocatedType()) *
+        arraySize->getZExtValue();
----------------
Because of this especially, please make DerefBytes a uint64_t (instead of just unsigned).


================
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:843
+  bool CanBeNull;
+  uint64_t destSize = 0;
+
----------------
destSize -> DestSize (and similar for other variables below as per our coding conventions)


https://reviews.llvm.org/D40723





More information about the llvm-commits mailing list