forked from llvm-mirror/llvm
-
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.
Support lowering of empty aggregates.
This crash was pretty common while compiling Rust for iOS (armv7). Reason - SjLj preparation step was lowering aggregate arguments as ExtractValue + InsertValue. ExtractValue has assertion which checks that there is some data in value, which is not true in case of empty (no fields) structures. Rust uses them quite extensively so this patch uses a 'select true, %val, undef' instruction to lower the argument. Patch by Valerii Hiora. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212922 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
2 changed files
with
42 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
; RUN: llc -mtriple=armv7-apple-ios -O0 < %s | FileCheck %s | ||
; RUN: llc -mtriple=armv7-apple-ios -O1 < %s | FileCheck %s | ||
; RUN: llc -mtriple=armv7-apple-ios -O2 < %s | FileCheck %s | ||
; RUN: llc -mtriple=armv7-apple-ios -O3 < %s | FileCheck %s | ||
|
||
; SjLjEHPrepare shouldn't crash when lowering empty structs. | ||
; | ||
; Checks that between in case of empty structs used as arguments | ||
; nothing happens, i.e. there are no instructions between | ||
; __Unwind_SjLj_Register and actual @bar invocation | ||
|
||
|
||
define i8* @foo({} %c) { | ||
entry: | ||
; CHECK: bl __Unwind_SjLj_Register | ||
; CHECK-NEXT: {{[A-Z][a-zA-Z0-9]*}}: | ||
; CHECK-NEXT: bl _bar | ||
invoke void @bar () | ||
to label %unreachable unwind label %handler | ||
|
||
unreachable: | ||
unreachable | ||
|
||
handler: | ||
%tmp = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @baz to i8*) | ||
cleanup | ||
resume { i8*, i32 } undef | ||
} | ||
|
||
declare void @bar() | ||
declare i32 @baz(...) |