[PATCH] D20698: [ARM] Transform LDMs into writeback form to save code size

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 13:07:58 PDT 2016


mcrosier added inline comments.

================
Comment at: lib/Target/ARM/ARMLoadStoreOptimizer.cpp:1233
@@ +1232,3 @@
+        ((Mode != ARM_AM::da && Mode != ARM_AM::db) || Offset != -Bytes)) {
+
+      // We couldn't find an inc/dec to merge. But if the base is dead, we
----------------
Could we just predicate all/most of this code with optForMinSize()?

  // We couldn't find an inc/dec to merge. But if the base is dead, we can still
  // change to a writeback form as that will save us 2 bytes of code size. It can
  // create WAW hazards though, so only do it if we're minimizing code size.
  if (MBB.getParent()->getFunction()->optForMinSize()) {
    bool HighRegsUsed = false;
    for (unsigned i = 2, e = MI->getNumOperands(); i != e; ++i)
      if (MI->getOperand(i).getReg() >= ARM::R8) {
        HighRegsUsed = true;
        break;
      }
  
    if (BaseKill && MBB.getParent()->getFunction()->optForMinSize() &&
        !HighRegsUsed)
      MergeInstr = MBB.end();
  } else
    return false;


Repository:
  rL LLVM

http://reviews.llvm.org/D20698





More information about the llvm-commits mailing list