be slightly more subtle about skipping dbg_value instructions; otherwise, if a
authorJim Grosbach <grosbach@apple.com>
Wed, 9 Jun 2010 22:21:24 +0000 (22:21 +0000)
committerJim Grosbach <grosbach@apple.com>
Wed, 9 Jun 2010 22:21:24 +0000 (22:21 +0000)
dbg_value immediately follows a sequence of ldr/str instructions that should
be combined into an ldm/stm and is the last instruction in the block, then
combine may end up being skipped.

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

lib/Target/ARM/ARMLoadStoreOptimizer.cpp

index b39d44fb6f9717f6a27625f09e4a54b7e7e481e4..ab69f1e365ff64f8c72ee9601a2a6f39165b12e2 100644 (file)
@@ -1024,10 +1024,6 @@ bool ARMLoadStoreOpt::LoadStoreMultipleOpti(MachineBasicBlock &MBB) {
   RS->enterBasicBlock(&MBB);
   MachineBasicBlock::iterator MBBI = MBB.begin(), E = MBB.end();
   while (MBBI != E) {
-    if (MBBI->isDebugValue()) {
-      ++MBBI;
-      continue;
-    }
     if (FixInvalidRegPairOp(MBB, MBBI))
       continue;
 
@@ -1094,7 +1090,12 @@ bool ARMLoadStoreOpt::LoadStoreMultipleOpti(MachineBasicBlock &MBB) {
       }
     }
 
-    if (Advance) {
+    if (MBBI->isDebugValue()) {
+      ++MBBI;
+      if (MBBI == E)
+        // Reach the end of the block, try merging the memory instructions.
+        TryMerge = true;
+    } else if (Advance) {
       ++Position;
       ++MBBI;
       if (MBBI == E)