[llvm] r239482 - [WinEH] _except_handlerN uses 0 instead of 1 to indicate catch-all

Reid Kleckner reid at kleckner.net
Wed Jun 10 11:14:07 PDT 2015


Author: rnk
Date: Wed Jun 10 13:14:07 2015
New Revision: 239482

URL: http://llvm.org/viewvc/llvm-project?rev=239482&view=rev
Log:
[WinEH] _except_handlerN uses 0 instead of 1 to indicate catch-all

Our usage of 1 was a holdover from __C_specific_handler.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp
    llvm/trunk/test/CodeGen/X86/seh-catch-all.ll
    llvm/trunk/test/CodeGen/X86/win32-eh.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp?rev=239482&r1=239481&r2=239482&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp Wed Jun 10 13:14:07 2015
@@ -612,12 +612,10 @@ void WinException::emitExceptHandlerTabl
            "gaps in the SEH scope table");
     for (const SEHHandler &Handler : LPInfo->SEHHandlers) {
       // Emit the filter or finally function pointer, if present. Otherwise,
-      // emit '1' to indicate a catch-all.
-      const MCExpr *FilterOrFinally;
-      if (const Function *F = Handler.FilterOrFinally)
-        FilterOrFinally = create32bitRef(Asm->getSymbol(F));
-      else
-        FilterOrFinally = MCConstantExpr::create(1, Asm->OutContext);
+      // emit '0' to indicate a catch-all.
+      const Function *F = Handler.FilterOrFinally;
+      const MCExpr *FilterOrFinally =
+          create32bitRef(F ? Asm->getSymbol(F) : nullptr);
 
       // Compute the recovery address, which is a block address or null.
       const BlockAddress *BA = Handler.RecoverBA;

Modified: llvm/trunk/test/CodeGen/X86/seh-catch-all.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/seh-catch-all.ll?rev=239482&r1=239481&r2=239482&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/seh-catch-all.ll (original)
+++ llvm/trunk/test/CodeGen/X86/seh-catch-all.ll Wed Jun 10 13:14:07 2015
@@ -67,5 +67,5 @@ eh.resume:
 ; X86: .section .xdata,"dr"
 ; X86-NEXT: L__ehtable$main
 ; X86-NEXT: .long -1
-; X86-NEXT: .long 1
+; X86-NEXT: .long 0
 ; X86-NEXT: .long Ltmp{{[0-9]+}}

Modified: llvm/trunk/test/CodeGen/X86/win32-eh.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/win32-eh.ll?rev=239482&r1=239481&r2=239482&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/win32-eh.ll (original)
+++ llvm/trunk/test/CodeGen/X86/win32-eh.ll Wed Jun 10 13:14:07 2015
@@ -37,7 +37,7 @@ catchall:
 ; CHECK: .section .xdata,"dr"
 ; CHECK-LABEL: L__ehtable$use_except_handler3:
 ; CHECK-NEXT:  .long   -1
-; CHECK-NEXT:  .long   1
+; CHECK-NEXT:  .long   0
 ; CHECK-NEXT:  .long   Ltmp{{[0-9]+}}
 
 define void @use_except_handler4() {
@@ -77,7 +77,7 @@ catchall:
 ; CHECK-NEXT:  .long   9999
 ; CHECK-NEXT:  .long   0
 ; CHECK-NEXT:  .long   -2
-; CHECK-NEXT:  .long   1
+; CHECK-NEXT:  .long   0
 ; CHECK-NEXT:  .long   Ltmp{{[0-9]+}}
 
 define void @use_CxxFrameHandler3() {





More information about the llvm-commits mailing list