brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.4 KiB · fedb0c4 Raw
146 lines · plain
1; RUN: llc < %s | FileCheck %s2 3; Test case based on this source:4; int puts(const char*);5; __declspec(noinline) void crash() {6;   *(volatile int*)0 = 42;7; }8; int filt();9; void use_both() {10;   __try {11;     __try {12;       crash();13;     } __finally {14;       puts("__finally");15;     }16;   } __except (filt()) {17;     puts("__except");18;   }19; }20 21target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"22target triple = "x86_64-pc-windows-msvc"23 24$"\01??_C@_09KJEHOMHG@__finally?$AA@" = comdat any25 26$"\01??_C@_08MLCMLGHM@__except?$AA@" = comdat any27 28@"\01??_C@_09KJEHOMHG@__finally?$AA@" = linkonce_odr unnamed_addr constant [10 x i8] c"__finally\00", comdat, align 129@"\01??_C@_08MLCMLGHM@__except?$AA@" = linkonce_odr unnamed_addr constant [9 x i8] c"__except\00", comdat, align 130 31declare void @crash()32 33declare i32 @filt()34 35; Function Attrs: nounwind uwtable36define void @use_both() #1 personality ptr @__C_specific_handler {37entry:38  %exn.slot = alloca ptr39  %ehselector.slot = alloca i3240  invoke void @crash() #541          to label %invoke.cont unwind label %__finally42 43invoke.cont:                                      ; preds = %entry44  %0 = call ptr @llvm.localaddress()45  invoke void @"\01?fin$0@0@use_both@@"(i1 zeroext false, ptr %0) #546          to label %invoke.cont2 unwind label %catch.dispatch47 48invoke.cont2:                                     ; preds = %invoke.cont49  br label %__try.cont50 51__finally:                                             ; preds = %entry52  %cleanuppad = cleanuppad within none []53  %locals = call ptr @llvm.localaddress()54  invoke void @"\01?fin$0@0@use_both@@"(i1 zeroext true, ptr %locals) #5 [ "funclet"(token %cleanuppad) ]55          to label %invoke.cont3 unwind label %catch.dispatch56 57invoke.cont3:                                     ; preds = %__finally58  cleanupret from %cleanuppad unwind label %catch.dispatch59 60catch.dispatch:                                   ; preds = %invoke.cont3, %lpad161  %cs1 = catchswitch within none [label %__except] unwind to caller62 63__except:                                         ; preds = %catch.dispatch64  %catchpad = catchpad within %cs1 [ptr @"\01?filt$0@0@use_both@@"]65  %call = call i32 @puts(ptr @"\01??_C@_08MLCMLGHM@__except?$AA@") [ "funclet"(token %catchpad) ]66  catchret from %catchpad to label %__try.cont67 68__try.cont:                                       ; preds = %__except, %invoke.cont269  ret void70}71 72; CHECK-LABEL: use_both:73; CHECK: .Ltmp074; CHECK: callq crash75; CHECK: .Ltmp176; CHECK: .Ltmp477; CHECK: callq "?fin$0@0@use_both@@"78; CHECK: .Ltmp579; CHECK: retq80;81; CHECK: .seh_handlerdata82; CHECK-NEXT: .Luse_both$parent_frame_offset83; CHECK-NEXT: .long (.Llsda_end0-.Llsda_begin0)/1684; CHECK-NEXT: .Llsda_begin0:85; CHECK-NEXT: .long .Ltmp0@IMGREL86; CHECK-NEXT: .long .Ltmp1@IMGREL87; CHECK-NEXT: .long "?dtor$2@?0?use_both@4HA"@IMGREL88; CHECK-NEXT: .long 089; CHECK-NEXT: .long .Ltmp0@IMGREL90; CHECK-NEXT: .long .Ltmp1@IMGREL91; CHECK-NEXT: .long "?filt$0@0@use_both@@"@IMGREL92; CHECK-NEXT: .long .LBB0_{{[0-9]+}}@IMGREL93; CHECK-NEXT: .long .Ltmp4@IMGREL94; CHECK-NEXT: .long .Ltmp5@IMGREL95; CHECK-NEXT: .long "?filt$0@0@use_both@@"@IMGREL96; CHECK-NEXT: .long .LBB0_{{[0-9]+}}@IMGREL97; CHECK-NEXT: .Llsda_end0:98 99; Function Attrs: noinline nounwind100define internal i32 @"\01?filt$0@0@use_both@@"(ptr %exception_pointers, ptr %frame_pointer) #2 {101entry:102  %frame_pointer.addr = alloca ptr, align 8103  %exception_pointers.addr = alloca ptr, align 8104  %exn.slot = alloca ptr105  store ptr %frame_pointer, ptr %frame_pointer.addr, align 8106  store ptr %exception_pointers, ptr %exception_pointers.addr, align 8107  %0 = load ptr, ptr %exception_pointers.addr108  %1 = getelementptr inbounds { ptr, ptr }, ptr %0, i32 0, i32 0109  %2 = load ptr, ptr %1110  %3 = load i32, ptr %2111  %4 = zext i32 %3 to i64112  %5 = inttoptr i64 %4 to ptr113  store ptr %5, ptr %exn.slot114  %call = call i32 @filt()115  ret i32 %call116}117 118define internal void @"\01?fin$0@0@use_both@@"(i1 zeroext %abnormal_termination, ptr %frame_pointer) #3 {119entry:120  %frame_pointer.addr = alloca ptr, align 8121  %abnormal_termination.addr = alloca i8, align 1122  store ptr %frame_pointer, ptr %frame_pointer.addr, align 8123  %frombool = zext i1 %abnormal_termination to i8124  store i8 %frombool, ptr %abnormal_termination.addr, align 1125  %call = call i32 @puts(ptr @"\01??_C@_09KJEHOMHG@__finally?$AA@")126  ret void127}128 129declare i32 @puts(ptr) #3130 131declare i32 @__C_specific_handler(...)132 133; Function Attrs: nounwind readnone134declare ptr @llvm.localaddress() #4135 136; Function Attrs: nounwind readnone137declare i32 @llvm.eh.typeid.for(ptr) #4138 139attributes #0 = { noinline nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "use-soft-float"="false" }140attributes #1 = { nounwind uwtable "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "use-soft-float"="false" }141attributes #2 = { noinline nounwind "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "use-soft-float"="false" }142attributes #3 = { "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "use-soft-float"="false" }143attributes #4 = { nounwind readnone }144attributes #5 = { noinline }145attributes #6 = { nounwind }146