[llvm] r235656 - [WinEH] Ignore filter clauses while mapping landing pad blocks.

Andrew Kaylor andrew.kaylor at intel.com
Thu Apr 23 15:38:36 PDT 2015


Author: akaylor
Date: Thu Apr 23 17:38:36 2015
New Revision: 235656

URL: http://llvm.org/viewvc/llvm-project?rev=235656&view=rev
Log:
[WinEH] Ignore filter clauses while mapping landing pad blocks.


Added:
    llvm/trunk/test/CodeGen/X86/seh-filter.ll
Modified:
    llvm/trunk/lib/CodeGen/WinEHPrepare.cpp

Modified: llvm/trunk/lib/CodeGen/WinEHPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/WinEHPrepare.cpp?rev=235656&r1=235655&r2=235656&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/WinEHPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/WinEHPrepare.cpp Thu Apr 23 17:38:36 2015
@@ -1666,6 +1666,12 @@ void WinEHPrepare::mapLandingPadBlocks(L
   while (HandlersFound != NumClauses) {
     BasicBlock *NextBB = nullptr;
 
+    // Skip over filter clauses.
+    if (LPad->isFilter(HandlersFound)) {
+      ++HandlersFound;
+      continue;
+    }
+
     // See if the clause we're looking for is a catch-all.
     // If so, the catch begins immediately.
     Constant *ExpectedSelector = LPad->getClause(HandlersFound)->stripPointerCasts();

Added: llvm/trunk/test/CodeGen/X86/seh-filter.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/seh-filter.ll?rev=235656&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/seh-filter.ll (added)
+++ llvm/trunk/test/CodeGen/X86/seh-filter.ll Thu Apr 23 17:38:36 2015
@@ -0,0 +1,21 @@
+; RUN: llc -O0 -mtriple=x86_64-windows-msvc < %s | FileCheck %s
+
+declare void @g()
+define void @f() {
+  invoke void @g() to label %return unwind label %lpad
+
+return:
+  ret void
+
+lpad:
+  %ehptrs = landingpad {i8*, i32} personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
+    filter [0 x i8*] zeroinitializer
+  call void @__cxa_call_unexpected(i8* null)
+  unreachable
+}
+declare i32 @__C_specific_handler(...)
+declare void @__cxa_call_unexpected(i8*)
+
+; We don't emit entries for filters.
+; CHECK: .seh_handlerdata
+; CHECK: .long 0





More information about the llvm-commits mailing list