[PATCH] D82439: [ARM] Rearrange SizeReduction when using -Oz

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 24 07:32:22 PDT 2020


dmgreen added a comment.

This sounds good to me. And my results agree with your results that this is a nice improvement.

Ideally I think it would be better to do this all the time, not just for minsize. But my understanding from trying this a long time ago was that would mess up a lot of the schedulers we have that would take quite a bit of work to fix. It might be worth fixing them in the long run (with the way cortex-m cores can dual issue), but for codesize alone that shouldn't block you.



================
Comment at: llvm/lib/Target/ARM/ARMTargetMachine.cpp:523
     addPass(createThumb2SizeReductionPass([this](const Function &F) {
-      return this->TM->getSubtarget<ARMSubtarget>(F).restrictIT();
+      // Always run Thumb2SizeReduction before IfConversion
+      // when optimising for size
----------------
Can you combine this comment with the "in v8" one above.


================
Comment at: llvm/test/CodeGen/ARM/t2-shrink-ldrpost.ll:32
-; CHECK-LABEL: f_nominsize:
-; CHECK-NOT: ldm
 define void @f_nominsize(i32 %n, i32* nocapture %a, i32* nocapture readonly %b) optsize {
----------------
Can you leave in a comment that says this function shouldn't produce a ldm. And maybe one above that says that we should produce a ldm. It sounds useful to keep that around for future reference.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82439





More information about the llvm-commits mailing list