-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IR] Disallow loading and storing unsized types
Summary: It isn't clear what is the operational meaning of loading or storing an unsized types, since it cannot be lowered into something meaningful. Since there does not seem to be any practical need for it either, make such loads and stores illegal IR. Reviewers: majnemer, chandlerc Subscribers: mcrosier, llvm-commits Differential Revision: http://reviews.llvm.org/D20846 llvm-svn: 271402
- Loading branch information
Showing
3 changed files
with
40 additions
and
13 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
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,24 @@ | ||
; RUN: not opt -verify < %s 2>&1 | FileCheck %s | ||
|
||
%X = type opaque | ||
|
||
define void @f_0(%X* %ptr) { | ||
%t = load %X, %X* %ptr | ||
ret void | ||
; CHECK: loading unsized types is not allowed | ||
; CHECK-NEXT: %t = load %X, %X* %ptr | ||
} | ||
|
||
define void @f_1(%X %val, %X* %ptr) { | ||
store %X %val, %X* %ptr | ||
ret void | ||
; CHECK: storing unsized types is not allowed | ||
; CHECK-NEXT: store %X %val, %X* %ptr | ||
} | ||
|
||
define void @f_2() { | ||
%t = alloca %X | ||
ret void | ||
; CHECK: Cannot allocate unsized type | ||
; CHECK-NEXT: %t = alloca %X | ||
} |