[PATCH] D22533: [LSV] Use make_range, and reformat a DEBUG message. NFC

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 19 14:17:46 PDT 2016


jlebar created this revision.
jlebar added a reviewer: asbirlea.
jlebar added subscribers: arsenm, llvm-commits.
Herald added a subscriber: mzolotukhin.

The DEBUG message was hard to read because two Values were being printed
on the same line with only the delimiter "aliases".  This change makes
us print each Value on its own line.

https://reviews.llvm.org/D22533

Files:
  lib/Transforms/Vectorize/LoadStoreVectorizer.cpp

Index: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
===================================================================
--- lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
+++ lib/Transforms/Vectorize/LoadStoreVectorizer.cpp
@@ -431,14 +431,15 @@
   SmallVector<std::pair<Value *, unsigned>, 16> ChainInstrs;
 
   unsigned InstrIdx = 0;
-  for (auto I = From; I != To; ++I, ++InstrIdx) {
+  for (Instruction &I : make_range(From, To)) {
+    ++InstrIdx;
     if (isa<LoadInst>(I) || isa<StoreInst>(I)) {
-      if (!is_contained(Chain, &*I))
-        MemoryInstrs.push_back({&*I, InstrIdx});
+      if (!is_contained(Chain, &I))
+        MemoryInstrs.push_back({&I, InstrIdx});
       else
-        ChainInstrs.push_back({&*I, InstrIdx});
-    } else if (I->mayHaveSideEffects()) {
-      DEBUG(dbgs() << "LSV: Found side-effecting operation: " << *I << '\n');
+        ChainInstrs.push_back({&I, InstrIdx});
+    } else if (I.mayHaveSideEffects()) {
+      DEBUG(dbgs() << "LSV: Found side-effecting operation: " << I << '\n');
       return 0;
     }
   }
@@ -477,11 +478,13 @@
           Value *Ptr0 = getPointerOperand(M0);
           Value *Ptr1 = getPointerOperand(M1);
 
-          dbgs() << "LSV: Found alias.\n"
-                    "        Aliasing instruction and pointer:\n"
-                 << *MemInstrValue << " aliases " << *Ptr0 << '\n'
-                 << "        Aliased instruction and pointer:\n"
-                 << *ChainInstrValue << " aliases " << *Ptr1 << '\n';
+          dbgs() << "LSV: Found alias:\n"
+                    "Aliasing instruction and pointer:\n"
+                 << *MemInstrValue << '\n'
+                 << *Ptr0 << '\n'
+                 << "Aliased instruction and pointer:\n"
+                 << *ChainInstrValue << '\n'
+                 << *Ptr1 << '\n';
         });
 
         return ChainIdx;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22533.64562.patch
Type: text/x-patch
Size: 1860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160719/5d5e04e2/attachment.bin>


More information about the llvm-commits mailing list