[PATCH] D14878: findDeadCallerSavedReg needs to pay attention to calling convention
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 22 12:24:36 PST 2015
majnemer added inline comments.
================
Comment at: lib/Target/X86/X86FrameLowering.cpp:156
@@ -155,10 +155,3 @@
- static const uint16_t CallerSavedRegs32Bit[] = {
- X86::EAX, X86::EDX, X86::ECX, 0
- };
-
- static const uint16_t CallerSavedRegs64Bit[] = {
- X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,
- X86::R8, X86::R9, X86::R10, X86::R11, 0
- };
+ const TargetRegisterClass& AvailableRegs = *TRI->getPointerRegClass(*MF, 4);
----------------
Reference token should lean right.
================
Comment at: lib/Target/X86/X86FrameLowering.cpp:160-163
@@ -159,6 +157,1 @@
-
- static const uint16_t CallerSavedRegs64Bit[] = {
- X86::RAX, X86::RDX, X86::RCX, X86::RSI, X86::RDI,
- X86::R8, X86::R9, X86::R10, X86::R11, 0
- };
----------------
majnemer wrote:
> `getPointerRegClass` will return `GR64_TC` which differs from `CallerSavedRegs64Bit` in that it doesn't include `R10` but does include `RIP`. I reckon that `GR64_TC` is wrong and should match `CallerSavedRegs64Bit`, what do you think?
Ah, `RIP` was added to silence the following machine verifier check:
https://github.com/llvm-mirror/llvm/blob/5ca8076fccc1aa4860ab0d2fd741b60dd1ba269b/lib/CodeGen/MachineVerifier.cpp#L925
The following test case run with `llc -verify-coalescing` will cause us to trigger that verifier check...
target triple = "x86_64-pc-win32"
@fnptr = external global void ()*
define void @test() {
entry:
%p = load void ()*, void ()** @fnptr
tail call void %p()
ret void
}
I'll go fix this for Win64...
================
Comment at: lib/Target/X86/X86FrameLowering.cpp:186
@@ +185,3 @@
+ for (auto CS : AvailableRegs)
+ if (!Uses.count(CS))
+ return CS;
----------------
I think we are OK with `getPointerRegClass` giving back `RIP` if we make sure to filter it out.
Repository:
rL LLVM
http://reviews.llvm.org/D14878
More information about the llvm-commits
mailing list