[PATCH] D98326: Delete two if-statements in InstCombineCalls.cpp

Mingrui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 10 02:44:55 PST 2021


frokaikan created this revision.
frokaikan added a reviewer: majnemer.
Herald added a subscriber: hiraditya.
frokaikan requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

These two if-statements check if the 3rd argument of memcpy intrinsic is 1, and then do nothing.
It aims to replace the intrinsic with load/store instruction, but it will be done in the later code. 
Consequently, the two if-statements are redundant, and should be removed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98326

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp


Index: llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -730,13 +730,6 @@
     if (Constant *NumBytes = dyn_cast<Constant>(MI->getLength())) {
       if (NumBytes->isNullValue())
         return eraseInstFromFunction(CI);
-
-      if (ConstantInt *CI = dyn_cast<ConstantInt>(NumBytes))
-        if (CI->getZExtValue() == 1) {
-          // Replace the instruction with just byte operations.  We would
-          // transform other cases to loads/stores, but we don't know if
-          // alignment is sufficient.
-        }
     }
 
     // No other transformations apply to volatile transfers.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98326.329582.patch
Type: text/x-patch
Size: 785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210310/de4de670/attachment.bin>


More information about the llvm-commits mailing list