summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2016-05-19 20:15:33 +0000
committerHans Wennborg <hans@hanshq.net>2016-05-19 20:15:33 +0000
commit172eee9cfc1a7963aded8b29784b9d9190c1d6b0 (patch)
tree1391607593abb6402e3cfd9c83f9dd7f076fceef /llvm/lib
parent3650bbeebc07f3d4cfd026bbb5088432bb1766e6 (diff)
downloadbcm5719-llvm-172eee9cfc1a7963aded8b29784b9d9190c1d6b0.tar.gz
bcm5719-llvm-172eee9cfc1a7963aded8b29784b9d9190c1d6b0.zip
X86: Don't reset the stack after calls that don't return (PR27117)
Since the calls don't return, the instruction afterwards will never run, and is just taking up unnecessary space in the binary. Differential Revision: http://reviews.llvm.org/D20406 llvm-svn: 270109
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 0fd7b173015..0f5f72e40da 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -3380,6 +3380,12 @@ X86TargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
else
NumBytesForCalleeToPop = 0; // Callee pops nothing.
+ if (CLI.DoesNotReturn && !getTargetMachine().Options.TrapUnreachable) {
+ // No need to reset the stack after the call if the call doesn't return. To
+ // make the MI verify, we'll pretend the callee does it for us.
+ NumBytesForCalleeToPop = NumBytes;
+ }
+
// Returns a flag for retval copy to use.
if (!IsSibcall) {
Chain = DAG.getCALLSEQ_END(Chain,
OpenPOWER on IntegriCloud