[ARM][FIX] Ran out of registers due tail recursion
authorDiogo N. Sampaio <diogo.sampaio@arm.com>
Mon, 3 Jun 2019 08:58:05 +0000 (08:58 +0000)
committerDiogo N. Sampaio <diogo.sampaio@arm.com>
Mon, 3 Jun 2019 08:58:05 +0000 (08:58 +0000)
commitdf92f841105e23be1f2c3fe6bcc543d53cbf7576
treed6fa4dbe02bea05bf6f1e6c2c8372c053a8e54b4
parenta0bd6f8a1ae73887fc32b85cd44e85435310f9d3
[ARM][FIX] Ran out of registers due tail recursion

Summary:
- pr42062
When compiling for MinSize,
ARMTargetLowering::LowerCall decides to indirect
multiple calls to a same function. However,
it disconsiders the limitation that thumb1
indirect calls require the callee to be in a
register from r0 to r3 (llvm limiation).
If all those registers are used by arguments, the
compiler dies with "error: run out of registers
during register allocation".
This patch tells the function
IsEligibleForTailCallOptimization if we intend to
perform indirect calls, as to avoid tail call
optimization.

Reviewers: dmgreen, efriedma

Reviewed By: efriedma

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D62683

llvm-svn: 362366
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/ARM/ARMISelLowering.h
llvm/test/CodeGen/ARM/pr42062.ll [new file with mode: 0644]