[PATCH] D89800: [ARM][LowOverheadLoops] Don't generate a LOL if lr is redefined after the start

Sam Parker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 03:57:29 PDT 2020


samparker added inline comments.


================
Comment at: llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp:1057
     if (Start->getOperand(0).getReg() == ARM::LR) {
-      InsertPt = MachineBasicBlock::iterator(Start);
-      InsertBB = Start->getParent();
-      return true;
+      auto *LRDef = RDA.getLocalLiveOutMIDef(Start->getParent(), ARM::LR);
+      auto *StartLRDef = RDA.getUniqueReachingMIDef(Start, ARM::LR);
----------------
I think what we need to do is check that the value is live-in the loop header block. Which makes the current call to if (!RDA.isSafeToDefRegAt(Start, ARM::LR)) seem bogus and is probably there to catch when WhileLoopStart is in the header and the mov lr is in the preheader. With Dave's work on DLS, most of this mumbo jumbo will get removed, but we still need to ensure we can insert a WLS safely, which is what this check should be doing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89800/new/

https://reviews.llvm.org/D89800



More information about the llvm-commits mailing list