Issue Details: The addresses for SEH tables for Windows are incorrect as 1 was unconditionally being added to all addresses. +1 is required for the SEH end address (as it is exclusive), but the SEH start addresses is inclusive and so should be used as-is. In the IP2State tables, the addresses are +1 for AMD64 to handle the return address for a call being after the actual call instruction but are as-is for ARM and ARM64 as the `StateFromIp` function in the VC runtime automatically takes this into account and adjusts the address that is it looking up. Fix Details: * Split the `getLabel` function into two: `getLabel` (used for the SEH start address and ARM+ARM64 IP2State addresses) and `getLabelPlusOne` (for the SEH end address, and AMD64 IP2State addresses). Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D107784
54 lines
1.5 KiB
LLVM
54 lines
1.5 KiB
LLVM
; RUN: llc -verify-machineinstrs < %s | FileCheck %s
|
|
|
|
; BranchFolding used to remove our empty landingpad block, which is
|
|
; undesirable.
|
|
|
|
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-pc-windows-msvc18.0.0"
|
|
|
|
declare i32 @__C_specific_handler(...)
|
|
|
|
declare void @bar()
|
|
|
|
define void @foo(i1 %cond) personality i32 (...)* @__C_specific_handler {
|
|
entry:
|
|
br i1 %cond, label %return, label %try
|
|
|
|
try: ; preds = %entry
|
|
invoke void @bar()
|
|
to label %fallthrough unwind label %dispatch
|
|
|
|
dispatch: ; preds = %try
|
|
%cs1 = catchswitch within none [label %catch] unwind to caller
|
|
|
|
catch: ; preds = %dispatch
|
|
%0 = catchpad within %cs1 [i8* null]
|
|
catchret from %0 to label %return
|
|
|
|
fallthrough: ; preds = %try
|
|
unreachable
|
|
|
|
return: ; preds = %catch, %entry
|
|
ret void
|
|
}
|
|
|
|
; CHECK-LABEL: foo: # @foo
|
|
; CHECK: testb $1, %cl
|
|
; CHECK: je .LBB0_[[try:[0-9]+]]
|
|
; CHECK: .LBB0_[[return:[0-9]+]]:
|
|
; CHECK: retq
|
|
; CHECK: .LBB0_[[try]]:
|
|
; CHECK: .Ltmp0:
|
|
; CHECK: callq bar
|
|
; CHECK: .Ltmp1:
|
|
; CHECK: .LBB0_[[catch:[0-9]+]]:
|
|
|
|
; CHECK: .seh_handlerdata
|
|
; CHECK-NEXT: .set .Lfoo$parent_frame_offset, 32
|
|
; CHECK-NEXT: .long (.Llsda_end0-.Llsda_begin0)/16
|
|
; CHECK-NEXT: .Llsda_begin0:
|
|
; CHECK-NEXT: .long .Ltmp0@IMGREL
|
|
; CHECK-NEXT: .long .Ltmp1@IMGREL+1
|
|
; CHECK-NEXT: .long 1
|
|
; CHECK-NEXT: .long .LBB0_[[catch]]@IMGREL
|