summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-03-28 14:52:21 +0000
committerKrzysztof Parzyszek <kparzysz@codeaurora.org>2016-03-28 14:52:21 +0000
commitbb63f66686ce2fd17e7391596dad35451328a66f (patch)
treebd9e13e3faa9e9e060790a483af5d19bb05c7aa4 /llvm/lib/Target
parenta34901aae965d3006d528a1487f8a4880ce215e2 (diff)
downloadbcm5719-llvm-bb63f66686ce2fd17e7391596dad35451328a66f.tar.gz
bcm5719-llvm-bb63f66686ce2fd17e7391596dad35451328a66f.zip
[Hexagon] Only use restore functions for single register at -Oz
llvm-svn: 264581
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
index 2b7c71c1c97..81c85c4aa21 100644
--- a/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
@@ -2218,7 +2218,18 @@ bool HexagonFrameLowering::useRestoreFunction(MachineFunction &MF,
const CSIVect &CSI) const {
if (shouldInlineCSR(MF, CSI))
return false;
+ // The restore functions do a bit more than just restoring registers.
+ // The non-returning versions will go back directly to the caller's
+ // caller, others will clean up the stack frame in preparation for
+ // a tail call. Using them can still save code size even if only one
+ // register is getting restores. Make the decision based on -Oz:
+ // using -Os will use inline restore for a single register.
+ if (isMinSize(MF))
+ return true;
unsigned NumCSI = CSI.size();
+ if (NumCSI <= 1)
+ return false;
+
unsigned Threshold = isOptSize(MF) ? SpillFuncThresholdOs-1
: SpillFuncThreshold;
return Threshold < NumCSI;
OpenPOWER on IntegriCloud