From fbb7433e076fcaa297905347a6c516935d2b90bc Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 30 Nov 2015 19:04:19 +0000 Subject: [PATCH] [X86] Add RIP to GR64_TCW64 The MachineVerifier wants to check that the register operands of an instruction belong to the instruction's register class. RIP-relative control flow instructions violated this by referencing RIP. While this was fixed for SysV, it was never fixed for Win64. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254315 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86RegisterInfo.td | 2 +- test/CodeGen/X86/coalescer-win64.ll | 16 ++++++++++++++++ test/CodeGen/X86/x86-shrink-wrapping.ll | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 test/CodeGen/X86/coalescer-win64.ll diff --git a/lib/Target/X86/X86RegisterInfo.td b/lib/Target/X86/X86RegisterInfo.td index 12f38c7946a..ceeb57d0cc4 100644 --- a/lib/Target/X86/X86RegisterInfo.td +++ b/lib/Target/X86/X86RegisterInfo.td @@ -375,7 +375,7 @@ def GR32_TC : RegisterClass<"X86", [i32], 32, (add EAX, ECX, EDX)>; def GR64_TC : RegisterClass<"X86", [i64], 64, (add RAX, RCX, RDX, RSI, RDI, R8, R9, R11, RIP)>; def GR64_TCW64 : RegisterClass<"X86", [i64], 64, (add RAX, RCX, RDX, - R8, R9, R10, R11)>; + R8, R9, R10, R11, RIP)>; // GR8_NOREX - GR8 registers which do not require a REX prefix. def GR8_NOREX : RegisterClass<"X86", [i8], 8, diff --git a/test/CodeGen/X86/coalescer-win64.ll b/test/CodeGen/X86/coalescer-win64.ll new file mode 100644 index 00000000000..ff084ae5b9e --- /dev/null +++ b/test/CodeGen/X86/coalescer-win64.ll @@ -0,0 +1,16 @@ +; RUN: llc < %s -verify-coalescing | FileCheck %s +target triple = "x86_64-pc-win32" + +@fnptr = external global void ()* + +define void @test1() { +entry: + %p = load void ()*, void ()** @fnptr + tail call void %p() + ret void +} + +; CHECK-LABEL: test1{{$}} +; CHECK: .seh_proc test1{{$}} +; CHECK: rex64 jmpq *fnptr(%rip) +; CHECK: .seh_endproc diff --git a/test/CodeGen/X86/x86-shrink-wrapping.ll b/test/CodeGen/X86/x86-shrink-wrapping.ll index 52e094b5417..0cab17f9de8 100644 --- a/test/CodeGen/X86/x86-shrink-wrapping.ll +++ b/test/CodeGen/X86/x86-shrink-wrapping.ll @@ -445,9 +445,9 @@ if.end: ; preds = %for.body, %if.else ; CHECK-NEXT: xorl %eax, %eax ; CHECK-NEXT: %esi, %edi ; CHECK-NEXT: %esi, %edx +; CHECK-NEXT: %esi, %ecx ; CHECK-NEXT: %esi, %r8d ; CHECK-NEXT: %esi, %r9d -; CHECK-NEXT: %esi, %ecx ; CHECK-NEXT: callq _someVariadicFunc ; CHECK-NEXT: movl %eax, %esi ; CHECK-NEXT: shll $3, %esi -- 2.34.1