[llvm] r259161 - [WinEH] Don't perform state stores in cleanups

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 28 21:33:15 PST 2016


Author: majnemer
Date: Thu Jan 28 23:33:15 2016
New Revision: 259161

URL: http://llvm.org/viewvc/llvm-project?rev=259161&view=rev
Log:
[WinEH] Don't perform state stores in cleanups

Our cleanups do not support true lexical nesting of funclets which
obviates the need to perform state stores.

This fixes PR26361.

Modified:
    llvm/trunk/lib/Target/X86/X86WinEHState.cpp
    llvm/trunk/test/CodeGen/WinEH/wineh-statenumbering-cleanups.ll
    llvm/trunk/test/CodeGen/WinEH/wineh-statenumbering.ll
    llvm/trunk/test/CodeGen/X86/win32-seh-nested-finally.ll

Modified: llvm/trunk/lib/Target/X86/X86WinEHState.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86WinEHState.cpp?rev=259161&r1=259160&r2=259161&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86WinEHState.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86WinEHState.cpp Thu Jan 28 23:33:15 2016
@@ -425,6 +425,10 @@ void WinEHStatePass::addStateStores(Func
     BasicBlock *FuncletEntryBB = BBColors.front();
     if (auto *FuncletPad =
             dyn_cast<FuncletPadInst>(FuncletEntryBB->getFirstNonPHI())) {
+      // We do not support nesting funclets within cleanuppads.
+      if (isa<CleanupPadInst>(FuncletPad))
+        continue;
+
       auto BaseStateI = FuncInfo.FuncletBaseStateMap.find(FuncletPad);
       if (BaseStateI != FuncInfo.FuncletBaseStateMap.end())
         BaseState = BaseStateI->second;

Modified: llvm/trunk/test/CodeGen/WinEH/wineh-statenumbering-cleanups.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/wineh-statenumbering-cleanups.ll?rev=259161&r1=259160&r2=259161&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WinEH/wineh-statenumbering-cleanups.ll (original)
+++ llvm/trunk/test/CodeGen/WinEH/wineh-statenumbering-cleanups.ll Thu Jan 28 23:33:15 2016
@@ -44,7 +44,6 @@ entry:
     to label %exit unwind label %cleanup.pad
 cleanup.pad:
   ; CHECK: cleanup.pad:
-  ; CHECK:   store i32 1
   ; CHECK:   invoke void @f(i32 0)
   %cleanup = cleanuppad within none []
   invoke void @f(i32 0)

Modified: llvm/trunk/test/CodeGen/WinEH/wineh-statenumbering.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/WinEH/wineh-statenumbering.ll?rev=259161&r1=259160&r2=259161&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/WinEH/wineh-statenumbering.ll (original)
+++ llvm/trunk/test/CodeGen/WinEH/wineh-statenumbering.ll Thu Jan 28 23:33:15 2016
@@ -120,7 +120,6 @@ try.cont4:
 ehcleanup:                                        ; preds = %catch.dispatch1
   %4 = cleanuppad within %1 []
   ; CHECK: ehcleanup:
-  ; CHECK:   store i32 -1
   ; CHECK:   call void @dtor()
   call void @dtor() #3 [ "funclet"(token %4) ]
   cleanupret from %4 unwind to caller

Modified: llvm/trunk/test/CodeGen/X86/win32-seh-nested-finally.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/win32-seh-nested-finally.ll?rev=259161&r1=259160&r2=259161&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/win32-seh-nested-finally.ll (original)
+++ llvm/trunk/test/CodeGen/X86/win32-seh-nested-finally.ll Thu Jan 28 23:33:15 2016
@@ -56,7 +56,6 @@ attributes #3 = { noinline }
 ; CHECK: LBB0_[[inner:[0-9]+]]: # %ehcleanup
 ; CHECK: pushl %ebp
 ; CHECK: addl $12, %ebp
-; CHECK: movl $0, -[[state]](%ebp)
 ; CHECK: movl $2, (%esp)
 ; CHECK: calll _f
 ; CHECK: popl %ebp
@@ -65,7 +64,6 @@ attributes #3 = { noinline }
 ; CHECK: LBB0_[[outer:[0-9]+]]: # %ehcleanup.3
 ; CHECK: pushl %ebp
 ; CHECK: addl $12, %ebp
-; CHECK: movl $-1, -[[state]](%ebp)
 ; CHECK: movl $3, (%esp)
 ; CHECK: calll _f
 ; CHECK: popl %ebp




More information about the llvm-commits mailing list