[PATCH] D79785: [ARM] Register pressure with -mthumb forces register reload before each call

Prathamesh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 08:31:45 PDT 2020


prathamesh updated this revision to Diff 287988.
prathamesh added a comment.

Hi,
Thanks for the catch! I tried your example, and it crashed llc with my patch. In the attached patch, I followed your suggestion to dyn_cast CPE.Val.ConstVal to Function * and that worked.

Also, I added another heuristic to ARMTargetLowering::LowerCall, to check that F.arg_size() + number of arguments does not exceed available number of registers, and in that case, and avoid emitting indirect calls (to be again turned into direct call later). This doesn't catch all cases, but catches common cases where argument requires only one reg to compute. With the heuristic, all calls to g are direct in minsize-call-cse-2.ll.

Tested with make check-llvm. Testing SPEC2006 for code size shows minimal differences, and for tinycrypt shows overall improvement.
Does the patch look OK ?


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

https://reviews.llvm.org/D79785

Files:
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/Thumb1InstrInfo.cpp
  llvm/lib/Target/ARM/Thumb1InstrInfo.h
  llvm/test/CodeGen/ARM/minsize-call-cse-2.ll
  llvm/test/CodeGen/ARM/minsize-call-cse-3.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79785.287988.patch
Type: text/x-patch
Size: 4694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200826/d2142351/attachment.bin>


More information about the llvm-commits mailing list