1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

DataLayout: Validate that the pref alignment is at least the ABI align

llvm-svn: 229355
This commit is contained in:
David Majnemer 2015-02-16 05:41:55 +00:00
parent 18f3685387
commit 271992a42e
2 changed files with 7 additions and 1 deletions

View File

@ -424,7 +424,10 @@ DataLayout::findPointerLowerBound(uint32_t AddressSpace) {
void DataLayout::setPointerAlignment(uint32_t AddrSpace, unsigned ABIAlign,
unsigned PrefAlign,
uint32_t TypeByteWidth) {
assert(ABIAlign <= PrefAlign && "Preferred alignment worse than ABI!");
if (PrefAlign < ABIAlign)
report_fatal_error(
"Preferred alignment cannot be less than the ABI alignment");
PointersTy::iterator I = findPointerLowerBound(AddrSpace);
if (I == Pointers.end() || I->AddressSpace != AddrSpace) {
Pointers.insert(I, PointerAlignElem::get(AddrSpace, ABIAlign, PrefAlign,

View File

@ -0,0 +1,3 @@
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
target datalayout = "p:32:32:16"
; CHECK: Preferred alignment cannot be less than the ABI alignment