[PATCH] D35262: Teach isAddressUse() in LoopStrengthReduce.cpp about memory intrinsics

Jonas Paulsson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 08:58:58 PDT 2017


jonpa created this revision.
Herald added a subscriber: mzolotukhin.

This was originally part of https://reviews.llvm.org/D35049, but broken out of it on request.

Return true for memset, memcpy and memmove for the address operands.

There is no test included here, but there is a test that depends on this in the original revision.


https://reviews.llvm.org/D35262

Files:
  lib/Transforms/Scalar/LoopStrengthReduce.cpp


Index: lib/Transforms/Scalar/LoopStrengthReduce.cpp
===================================================================
--- lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -776,10 +776,17 @@
     // of intrinsics.
     switch (II->getIntrinsicID()) {
       default: break;
+      case Intrinsic::memset:
       case Intrinsic::prefetch:
         if (II->getArgOperand(0) == OperandVal)
           isAddress = true;
         break;
+      case Intrinsic::memmove:
+      case Intrinsic::memcpy:
+        if (II->getArgOperand(0) == OperandVal ||
+            II->getArgOperand(1) == OperandVal)
+          isAddress = true;
+        break;
     }
   } else if (AtomicRMWInst *RMW = dyn_cast<AtomicRMWInst>(Inst)) {
     if (RMW->getPointerOperand() == OperandVal)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35262.106040.patch
Type: text/x-patch
Size: 813 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170711/a3b191bd/attachment.bin>


More information about the llvm-commits mailing list