[PATCH] D15522: [X86] MOVPC32r should only emit CFI adjustments when needed

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 15 10:53:45 PST 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL255664: [X86] MOVPC32r should only emit CFI adjustments when needed (authored by mkuper).

Changed prior to commit:
  http://reviews.llvm.org/D15522?vs=42834&id=42878#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15522

Files:
  llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
  llvm/trunk/test/CodeGen/X86/pr25828.ll

Index: llvm/trunk/test/CodeGen/X86/pr25828.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/pr25828.ll
+++ llvm/trunk/test/CodeGen/X86/pr25828.ll
@@ -0,0 +1,30 @@
+; RUN: llc < %s -mtriple=i686-pc-windows-msvc -relocation-model=pic | FileCheck %s
+; MOVPC32r should not generate CFI under windows
+
+; CHECK-LABEL: _foo:
+; CHECK-NOT: .cfi_adjust_cfa_offset
+define void @foo(i8) {
+entry-block:
+  switch i8 %0, label %bb2 [
+    i8 1, label %bb1
+    i8 2, label %bb2
+    i8 3, label %bb3
+    i8 4, label %bb4
+    i8 5, label %bb5
+  ]
+
+bb1:
+  ret void
+
+bb2:
+  ret void
+
+bb3:
+  ret void
+
+bb4:
+  ret void
+
+bb5:
+  ret void
+}
Index: llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
@@ -1145,11 +1145,12 @@
     bool hasFP = FrameLowering->hasFP(*MF);
     
     // TODO: This is needed only if we require precise CFA.
-    bool NeedsDwarfCFI = 
-         (MMI->hasDebugInfo() || MF->getFunction()->needsUnwindTableEntry());
+    bool HasActiveDwarfFrame = OutStreamer->getNumFrameInfos() &&
+                               !OutStreamer->getDwarfFrameInfos().back().End;
+
     int stackGrowth = -RI->getSlotSize();
 
-    if (NeedsDwarfCFI && !hasFP) {
+    if (HasActiveDwarfFrame && !hasFP) {
       OutStreamer->EmitCFIAdjustCfaOffset(-stackGrowth);
     }
 
@@ -1160,7 +1161,7 @@
     EmitAndCountInstruction(MCInstBuilder(X86::POP32r)
                             .addReg(MI->getOperand(0).getReg()));
 
-    if (NeedsDwarfCFI && !hasFP) {
+    if (HasActiveDwarfFrame && !hasFP) {
       OutStreamer->EmitCFIAdjustCfaOffset(stackGrowth);
     }
     return;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15522.42878.patch
Type: text/x-patch
Size: 1798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151215/4771cc43/attachment.bin>


More information about the llvm-commits mailing list