forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ARM64] [Windows] Mark block address as taken when expanding catchrets
This fixes issue llvm#109250 The issue happens during the `MachineBlockPlacement` pass. The block, whose address was previously not taken, is deemed redundant by the pass and subsequently replaced using `MachineBasicBlock::ReplaceUsesOfBlockWith` in `BranchFolding`. ReplaceUsesOfBlockWith only replaces uses in the terminator. However, `expandPostRAPseudo` introduces new block uses when expanding catchrets. These uses do not get replaced, which results in undefined label errors later on. Marking the block addresss as taken prevents the replacement of the block, without also replacing non-terminator uses.
- Loading branch information
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
llvm/test/CodeGen/AArch64/wineh-catchret-obj-generation.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
; RUN: llc -mtriple aarch64-unknown-windows-msvc -filetype=obj %s -o %t.o | ||
|
||
declare i32 @__CxxFrameHandler3(...) | ||
|
||
declare void @llvm.seh.try.begin() #0 | ||
|
||
define fastcc ptr @test_function(i1 %0, ptr %_Fmtfl.i.i, i1 %1) personality ptr @__CxxFrameHandler3 { | ||
entry: | ||
br i1 %0, label %right-block527, label %left-block526 | ||
|
||
common.ret1: | ||
%common.ret1.op = phi ptr [ null, %left-block530 ], [ null, %some-block ], [ %_Fmtfl.i.i, %invoke.cont.i124 ], [ null, %left-block526 ] | ||
ret ptr %common.ret1.op | ||
|
||
invoke.cont.i124: | ||
%.not657 = icmp eq i32 1, 0 | ||
br i1 %.not657, label %some-block, label %common.ret1 | ||
|
||
catch.dispatch.i: | ||
%2 = catchswitch within none [label %catch.i] unwind to caller | ||
|
||
catch.i: | ||
%3 = catchpad within %2 [ptr null, i32 0, ptr null] | ||
catchret from %3 to label %some-block | ||
|
||
some-block: | ||
br label %common.ret1 | ||
|
||
left-block526: | ||
br i1 %1, label %common.ret1, label %left-block530 | ||
|
||
right-block527: | ||
invoke void @llvm.seh.try.begin() | ||
to label %invoke.cont.i124 unwind label %catch.dispatch.i | ||
|
||
left-block530: | ||
%.not = icmp eq i32 0, 0 | ||
br label %common.ret1 | ||
} | ||
|
||
attributes #0 = { nounwind willreturn memory(write) } | ||
|
||
!llvm.module.flags = !{!0} | ||
|
||
!0 = !{i32 2, !"eh-asynch", i32 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters