Skip to content

Commit e147dcb

Browse files
authored
[SEH] Add test to track EHa register liveness verification (#76921)
This test tracks bug of MachineVerifier to check live range segment for EHa. Async exception can happen at any place within seh scope, not only the call instruction. Need to teach MachineVerifier to know that.
1 parent 202a4c0 commit e147dcb

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
; XFAIL: *
2+
; RUN: llc --verify-machineinstrs < %s
3+
source_filename = "test.cpp"
4+
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"
5+
target triple = "x86_64-pc-windows-msvc19.12.0"
6+
7+
$"?test@Test@@Plugin@@Host@@@Z" = comdat any
8+
9+
declare i32 @__CxxFrameHandler3(...)
10+
11+
; Function Attrs: nounwind memory(none)
12+
declare void @llvm.seh.scope.begin() #1
13+
14+
; Function Attrs: nobuiltin allocsize(0)
15+
declare ptr @"??2@Test@Z"(i64) #1
16+
17+
; Function Attrs: nounwind memory(none)
18+
declare void @llvm.seh.scope.end() #0
19+
20+
; Function Attrs: nobuiltin nounwind
21+
declare void @"??3@YAXPEAX@Z"(ptr) #2
22+
23+
; Function Attrs: mustprogress uwtable
24+
define ptr @"?test@Test@@Plugin@@Host@@@Z"(ptr %this, ptr %host) #3 comdat align 2 personality ptr @__CxxFrameHandler3 {
25+
entry:
26+
%host.addr = alloca ptr, align 8
27+
%this.addr = alloca ptr, align 8
28+
store ptr %host, ptr %host.addr, align 8
29+
store ptr %this, ptr %this.addr, align 8
30+
%this1 = load ptr, ptr %this.addr, align 8
31+
%call = call noalias ptr @"??2@Test@Z"(i64 152) #5
32+
invoke void @llvm.seh.scope.begin()
33+
to label %invoke.cont unwind label %ehcleanup
34+
35+
invoke.cont: ; preds = %entry
36+
%call3 = invoke ptr @"??Test@?A0x2749C4FD@@QEAA@Test@Test@@@Z"(ptr %call, ptr %this1)
37+
to label %invoke.cont2 unwind label %ehcleanup
38+
39+
invoke.cont2: ; preds = %invoke.cont
40+
invoke void @llvm.seh.scope.end()
41+
to label %invoke.cont4 unwind label %ehcleanup
42+
43+
invoke.cont4: ; preds = %invoke.cont2
44+
ret ptr %call
45+
46+
ehcleanup: ; preds = %invoke.cont2, %invoke.cont, %entry
47+
%0 = cleanuppad within none []
48+
call void @"??3@YAXPEAX@Z"(ptr %call) #6 [ "funclet"(token %0) ]
49+
cleanupret from %0 unwind to caller
50+
}
51+
52+
; Function Attrs: uwtable
53+
declare hidden ptr @"??Test@?A0x2749C4FD@@QEAA@Test@Test@@@Z"(ptr, ptr) #4 align 2
54+
55+
attributes #0 = { nounwind memory(none) }
56+
attributes #1 = { nobuiltin allocsize(0) "target-cpu"="x86-64" "target-features"="+cmov,+crc32,+cx8,+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "tune-cpu"="generic" }
57+
attributes #2 = { nobuiltin nounwind "target-cpu"="x86-64" "target-features"="+cmov,+crc32,+cx8,+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "tune-cpu"="generic" }
58+
attributes #3 = { mustprogress uwtable "target-cpu"="x86-64" "target-features"="+cmov,+crc32,+cx8,+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "tune-cpu"="generic" }
59+
attributes #4 = { uwtable "target-cpu"="x86-64" "target-features"="+cmov,+crc32,+cx8,+fxsr,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "tune-cpu"="generic" }
60+
attributes #5 = { builtin allocsize(0) }
61+
attributes #6 = { builtin nounwind }
62+
63+
!llvm.module.flags = !{!1, !2}
64+
65+
!1 = !{i32 2, !"eh-asynch", i32 1}
66+
!2 = !{i32 7, !"uwtable", i32 2}

0 commit comments

Comments
 (0)