forked from OSchip/llvm-project
SROA: Avoid struct and array types early to avoid creating an overly large integer type.
Fixes PR14465. Differential Revision: http://llvm-reviews.chandlerc.com/D148 llvm-svn: 169084
This commit is contained in:
parent
8e6d64a71d
commit
47534c7440
|
@ -2164,6 +2164,9 @@ static bool isIntegerWideningViable(const DataLayout &TD,
|
||||||
AllocaPartitioning::const_use_iterator I,
|
AllocaPartitioning::const_use_iterator I,
|
||||||
AllocaPartitioning::const_use_iterator E) {
|
AllocaPartitioning::const_use_iterator E) {
|
||||||
uint64_t SizeInBits = TD.getTypeSizeInBits(AllocaTy);
|
uint64_t SizeInBits = TD.getTypeSizeInBits(AllocaTy);
|
||||||
|
// Don't create integer types larger than the maximum bitwidth.
|
||||||
|
if (SizeInBits > IntegerType::MAX_INT_BITS)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Don't try to handle allocas with bit-padding.
|
// Don't try to handle allocas with bit-padding.
|
||||||
if (SizeInBits != TD.getTypeStoreSizeInBits(AllocaTy))
|
if (SizeInBits != TD.getTypeStoreSizeInBits(AllocaTy))
|
||||||
|
|
|
@ -1134,3 +1134,16 @@ entry:
|
||||||
ret void
|
ret void
|
||||||
; CHECK: ret
|
; CHECK: ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define void @PR14465() {
|
||||||
|
; Ensure that we don't crash when analyzing a alloca larger than the maximum
|
||||||
|
; integer type width (MAX_INT_BITS) supported by llvm (1048576*32 > (1<<23)-1).
|
||||||
|
; CHECK: @PR14465
|
||||||
|
|
||||||
|
%stack = alloca [1048576 x i32], align 16
|
||||||
|
; CHECK: alloca [1048576 x i32]
|
||||||
|
%cast = bitcast [1048576 x i32]* %stack to i8*
|
||||||
|
call void @llvm.memset.p0i8.i64(i8* %cast, i8 -2, i64 4194304, i32 16, i1 false)
|
||||||
|
ret void
|
||||||
|
; CHECK: ret
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue