[llvm-branch-commits] [llvm-branch] r269657 - Merging r263139:
Tom Stellard via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon May 16 07:43:06 PDT 2016
Author: tstellar
Date: Mon May 16 09:43:06 2016
New Revision: 269657
URL: http://llvm.org/viewvc/llvm-project?rev=269657&view=rev
Log:
Merging r263139:
------------------------------------------------------------------------
r263139 | michael.kuperstein | 2016-03-10 10:43:21 -0800 (Thu, 10 Mar 2016) | 12 lines
[X86] Correctly select registers to pop into for x86_64
When trying to replace an add to esp with pops, we need to choose dead
registers to pop into. Registers clobbered by the call and not imp-def'd
by it should be safe. Except that it's not enough to check the register
itself isn't defined, we also need to make sure no overlapping registers
are defined either.
This fixes PR26711.
Differential Revision: http://reviews.llvm.org/D18029
------------------------------------------------------------------------
Modified:
llvm/branches/release_38/lib/Target/X86/X86FrameLowering.cpp
llvm/branches/release_38/test/CodeGen/X86/pop-stack-cleanup.ll
Modified: llvm/branches/release_38/lib/Target/X86/X86FrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/Target/X86/X86FrameLowering.cpp?rev=269657&r1=269656&r2=269657&view=diff
==============================================================================
--- llvm/branches/release_38/lib/Target/X86/X86FrameLowering.cpp (original)
+++ llvm/branches/release_38/lib/Target/X86/X86FrameLowering.cpp Mon May 16 09:43:06 2016
@@ -2440,7 +2440,9 @@ bool X86FrameLowering::adjustStackWithPo
bool IsDef = false;
for (const MachineOperand &MO : Prev->implicit_operands()) {
- if (MO.isReg() && MO.isDef() && MO.getReg() == Candidate) {
+ if (MO.isReg() && MO.isDef() &&
+ (TRI->isSubRegisterEq(MO.getReg(), Candidate) ||
+ TRI->isSuperRegister(MO.getReg(), Candidate))) {
IsDef = true;
break;
}
Modified: llvm/branches/release_38/test/CodeGen/X86/pop-stack-cleanup.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/test/CodeGen/X86/pop-stack-cleanup.ll?rev=269657&r1=269656&r2=269657&view=diff
==============================================================================
--- llvm/branches/release_38/test/CodeGen/X86/pop-stack-cleanup.ll (original)
+++ llvm/branches/release_38/test/CodeGen/X86/pop-stack-cleanup.ll Mon May 16 09:43:06 2016
@@ -7,6 +7,7 @@ declare i64 @param2_ret64(i32 %a, i32 %b
declare void @param2(i32 %a, i32 %b)
declare void @param3(i32 %a, i32 %b, i32 %c)
declare void @param8(i64, i64, i64, i64, i64, i64, i64, i64)
+declare i32 @param8_ret(i64, i64, i64, i64, i64, i64, i64, i64)
define void @test() minsize nounwind {
@@ -74,3 +75,13 @@ define void @test_linux64(i32 %size) min
call void @param8(i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8)
ret void
}
+
+define i32 @test_linux64_i32(i32 %size) minsize nounwind {
+; LINUX64-LABEL: test_linux64_i32:
+; LINUX64: callq param8_ret
+; LINUX64-NOT: popq %rax
+; LINUX64: retq
+ %a = alloca i64, i32 %size, align 8
+ %r = call i32 @param8_ret(i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8)
+ ret i32 %r
+}
More information about the llvm-branch-commits
mailing list