Closed R-Goc closed 1 month ago
Completely reduced file, with skipping basic block passes:
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc19.42.34321"
; Function Attrs: nounwind willreturn memory(write)
declare void @llvm.seh.try.begin() #0
declare i32 @__C_specific_handler(...)
; Function Attrs: nounwind willreturn memory(write)
declare void @llvm.seh.try.end() #0
define ptr @"??$HandleSehExceptionsInMethodIfSupported@VTestFactoryBase@internal@testing@@PEAVTest@3@@internal@testing@@YAPEAVTest@1@PEAVTestFactoryBase@01@P8301@EAAPEAV21@XZPEBD@Z"() personality ptr @__C_specific_handler {
invoke void @llvm.seh.try.begin()
to label %8 unwind label %1
1: ; preds = %0
%2 = catchswitch within none [label %3] unwind to caller
3: ; preds = %1
%4 = catchpad within %2 [ptr null]
catchret from %4 to label %5
5: ; preds = %3
invoke void @llvm.seh.try.end()
to label %8 unwind label %6
6: ; preds = %5
%7 = cleanuppad within none []
cleanupret from %7 unwind to caller
8: ; preds = %5, %0
ret ptr null
}
attributes #0 = { nounwind willreturn memory(write) }
!llvm.module.flags = !{!0}
!0 = !{i32 2, !"eh-asynch", i32 1}
What's the reproducer script, or what failure point? Can I just check for the presence of the invoke?
What's the reproducer script, or what failure point? Can I just check for the presence of the invoke?
Managed to reproduce with FIleCheck on the invoke
I think this is an API bug in InvokeInst. It assumes that the unwind block ends in a landing pad instruction. It did not consider the possibility of unwind dest being catchswitch (which seems to be new)
The test script is (batch file)
"C:/Users/rysza/bin/llvm19-dbg/bin/llc.exe" %1% 2>&1 | rg "calculateSEHStateForAsynchEH"
depends on symbols being present to catch failure in this function. Couldn't get symbolizer to work, also this function can get inlined into CalculateSEHStateNumbers. So using a debug version of llvm.
Trying to debug https://github.com/llvm/llvm-project/issues/109576
This code was generated by clang-cl 19.1.0 with /EHa (async exceptions).
I think I have a quick fix for the assert. Actual support for reducing all of these catch instructions (which I don't understand) will be more work
Haven't read the entire language reference either.