[SROA] Switch to using a more direct debug logging technique in one part
authorChandler Carruth <chandlerc@gmail.com>
Thu, 1 Jan 2015 12:56:47 +0000 (12:56 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 1 Jan 2015 12:56:47 +0000 (12:56 +0000)
of my new load and store splitting, and fix a bug where it logged
a totally irrelevant slice rather than the actual slice in question.

The logging here previously worked because we used to place new slices
onto the back of the core sequence, but that caused other problems.
I updated the actual code to store new slices in their own vector but
didn't update the logging. There isn't a good way to reuse the logging
any more, and frankly it wasn't needed. We can directly log this bit
more easily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225063 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/SROA.cpp

index ce7d4aa714bd3949d6dd78c18c88c4dfadafc3a3..0869114e7f7a3707e6f1aacb7c28868f40ca7b27 100644 (file)
@@ -3702,8 +3702,9 @@ bool SROA::presplitLoadsAndStores(AllocaInst &AI, AllocaSlices &AS) {
           Slice(BaseOffset + PartOffset, BaseOffset + PartOffset + PartSize,
                 &PLoad->getOperandUse(PLoad->getPointerOperandIndex()),
                 /*IsSplittable*/ true));
-      DEBUG(AS.printSlice(dbgs(), std::prev(AS.end()), "    "));
-      DEBUG(dbgs() << ": " << *PLoad << "\n");
+      DEBUG(dbgs() << "    new slice [" << NewSlices.back().beginOffset()
+                   << ", " << NewSlices.back().endOffset() << "): " << *PLoad
+                   << "\n");
 
       // Setup the next partition.
       PartOffset = Offsets.Splits[Idx];
@@ -3837,8 +3838,9 @@ bool SROA::presplitLoadsAndStores(AllocaInst &AI, AllocaSlices &AS) {
           Slice(BaseOffset + PartOffset, BaseOffset + PartOffset + PartSize,
                 &PStore->getOperandUse(PStore->getPointerOperandIndex()),
                 /*IsSplittable*/ true));
-      DEBUG(AS.printSlice(dbgs(), std::prev(AS.end()), "    "));
-      DEBUG(dbgs() << ": " << *PStore << "\n");
+      DEBUG(dbgs() << "    new slice [" << NewSlices.back().beginOffset()
+                   << ", " << NewSlices.back().endOffset() << "): " << *PStore
+                   << "\n");
       if (!SplitLoads) {
         DEBUG(dbgs() << "      of split load: " << *PLoad << "\n");
       }