[Stackmaps] Make ithe frame-pointer required for stackmaps.
authorJuergen Ributzka <juergen@apple.com>
Thu, 2 Oct 2014 22:21:49 +0000 (22:21 +0000)
committerJuergen Ributzka <juergen@apple.com>
Thu, 2 Oct 2014 22:21:49 +0000 (22:21 +0000)
Do not eliminate the frame pointer if there is a stackmap or patchpoint in the
function. All stackmap references should be FP relative.

This fixes PR21107.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218920 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/AArch64/AArch64FrameLowering.cpp
lib/Target/X86/X86FrameLowering.cpp
test/CodeGen/X86/patchpoint-webkit_jscc.ll
test/CodeGen/X86/patchpoint.ll
test/CodeGen/X86/stackmap-fast-isel.ll
test/CodeGen/X86/stackmap-liveness.ll
test/CodeGen/X86/stackmap-nops.ll
test/CodeGen/X86/stackmap-shadow-optimization.ll
test/CodeGen/X86/stackmap.ll

index f40744cd8fbb8595321a26cbeb1a78df6b8f79ea..a7779d6236ac14fedf44f2ec29cd10b8f855d73a 100644 (file)
@@ -92,7 +92,8 @@ bool AArch64FrameLowering::hasFP(const MachineFunction &MF) const {
 #endif
 
   return (MFI->hasCalls() || MFI->hasVarSizedObjects() ||
-          MFI->isFrameAddressTaken());
+          MFI->isFrameAddressTaken() || MFI->hasStackMap() ||
+          MFI->hasPatchPoint());
 }
 
 /// hasReservedCallFrame - Under normal circumstances, when a frame pointer is
index 96954fc901b907065c15188074cf2bfea919d8d6..cfd68a5c1b418a01392caa65fbab6385b5f7f7ed 100644 (file)
@@ -53,7 +53,8 @@ bool X86FrameLowering::hasFP(const MachineFunction &MF) const {
           MFI->hasVarSizedObjects() ||
           MFI->isFrameAddressTaken() || MFI->hasInlineAsmWithSPAdjust() ||
           MF.getInfo<X86MachineFunctionInfo>()->getForceFramePointer() ||
-          MMI.callsUnwindInit() || MMI.callsEHReturn());
+          MMI.callsUnwindInit() || MMI.callsEHReturn() ||
+          MFI->hasStackMap() || MFI->hasPatchPoint());
 }
 
 static unsigned getSUBriOpcode(unsigned IsLP64, int64_t Imm) {
index 03f662ceadc586576f260e0c77fb160d4d50bfaf..5e76bf8d4e60a4fedb4c1b12b28b607869aef1ca 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=corei7 -disable-fp-elim                             < %s | FileCheck %s
-; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=corei7 -disable-fp-elim -fast-isel -fast-isel-abort < %s | FileCheck %s --check-prefix=FAST
+; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=corei7                             < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=corei7 -fast-isel -fast-isel-abort < %s | FileCheck %s --check-prefix=FAST
 
 ; Test the webkit_jscc calling convention.
 ; One argument will be passed in register, the other will be pushed on the stack.
index 53d05ef0a7e208aaecde17fbb54b815535b67c8c..07148f0329a2b50182d7809d726f04c2da64f0b4 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=corei7 -disable-fp-elim                             < %s | FileCheck %s
-; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=corei7 -disable-fp-elim -fast-isel -fast-isel-abort < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=corei7                             < %s | FileCheck %s
+; RUN: llc -mtriple=x86_64-apple-darwin -mcpu=corei7 -fast-isel -fast-isel-abort < %s | FileCheck %s
 
 ; Trivial patchpoint codegen
 ;
index 0b7e6dbdc7a27df02adc4cb337ab9931481c6a74..dfb16adaa339859f9a6c2791c30b594f5a5ea900 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 -disable-fp-elim                             | FileCheck %s
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 -disable-fp-elim -fast-isel -fast-isel-abort | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7                             | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 -fast-isel -fast-isel-abort | FileCheck %s
 
 ; CHECK-LABEL:  .section  __LLVM_STACKMAPS,__llvm_stackmaps
 ; CHECK-NEXT:  __LLVM_StackMaps:
index 897595db2438dc1e7b10ab949a6a79e12aec8188..31553c0b6842c9c9a4b5e127eef7405122fb59fb 100644 (file)
@@ -1,5 +1,5 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim -enable-patchpoint-liveness=false | FileCheck %s
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -disable-fp-elim                                   | FileCheck -check-prefix=PATCH %s
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -enable-patchpoint-liveness=false | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7-avx                                   | FileCheck -check-prefix=PATCH %s
 ;
 ; Note: Print verbose stackmaps using -debug-only=stackmaps.
 
index 7de63af852a94ec117b02e1cb9a3c7f0724f850f..7932c0dfb99d36c9b71d3582471c1ebbdd3e6f85 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 -disable-fp-elim | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck %s
 
 define void @nop_test() {
 entry:
index 63debe396b6651920b82929942c503fdb0b5e1cd..6f7c5935b8f2d38b0d879a476e72918a1fcb0ca5 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 -disable-fp-elim | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck %s
 
 ; Check that the X86 stackmap shadow optimization is only outputting a 1-byte
 ; nop here. 8-bytes are requested, but 7 are covered by the code for the call to
@@ -18,4 +18,4 @@ entry:
 }
 
 declare void @llvm.experimental.stackmap(i64, i32, ...)
-declare void @bar()
\ No newline at end of file
+declare void @bar()
index 3e87ee114bad9b848a5b62021dc505c3d74bdec8..5e356f3e03d1bf63ac2622ce2648fc622a396717 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 -disable-fp-elim | FileCheck %s
+; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck %s
 ;
 ; Note: Print verbose stackmaps using -debug-only=stackmaps.