Index: lib/CodeGen/GlobalMerge.cpp =================================================================== --- lib/CodeGen/GlobalMerge.cpp +++ lib/CodeGen/GlobalMerge.cpp @@ -511,6 +511,7 @@ if (!II) continue; const LandingPadInst *LPInst = II->getUnwindDest()->getLandingPadInst(); + if (!LPInst) continue; // Look for globals in the clauses of the landing pad instruction for (unsigned Idx = 0, NumClauses = LPInst->getNumClauses(); Idx != NumClauses; ++Idx) Index: test/CodeGen/ARM/Windows/exceptions-opt.ll =================================================================== --- /dev/null +++ test/CodeGen/ARM/Windows/exceptions-opt.ll @@ -0,0 +1,28 @@ +; RUN: llc -mtriple thumbv7--windows-msvc -o - %s | FileCheck %s + +%struct.B = type { i8 } + +@"\01?x@@3UB@@A" = global %struct.B zeroinitializer, align 1 +@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_exceptions.cpp, i8* null }] + +declare arm_aapcs_vfpcc void @"\01?f@B@@QAAXXZ"(%struct.B*) local_unnamed_addr #0 + +declare arm_aapcs_vfpcc i32 @__CxxFrameHandler3(...) + +define internal arm_aapcs_vfpcc void @_GLOBAL__sub_I_exceptions.cpp() #1 personality i32 (...)* @__CxxFrameHandler3 { + invoke arm_aapcs_vfpcc void @"\01?f@B@@QAAXXZ"(%struct.B* nonnull @"\01?x@@3UB@@A") + to label %5 unwind label %1 + +;