forked from OSchip/llvm-project
scalarrepl should not split the two elements of the vsiidx array:
int func(vFloat v0, vFloat v1) { int ii; vSInt32 vsiidx[2]; vsiidx[0] = _mm_cvttps_epi32(v0); vsiidx[1] = _mm_cvttps_epi32(v1); ii = ((int *) vsiidx)[4]; return ii; } This fixes Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll llvm-svn: 31524
This commit is contained in:
parent
2d7a5d9b5d
commit
4967f6ddea
|
@ -316,9 +316,13 @@ int SROA::isSafeUseOfAllocation(Instruction *User) {
|
|||
//
|
||||
// Scalar replacing *just* the outer index of the array is probably not
|
||||
// going to be a win anyway, so just give up.
|
||||
for (++I; I != E && isa<ArrayType>(*I); ++I) {
|
||||
const ArrayType *SubArrayTy = cast<ArrayType>(*I);
|
||||
uint64_t NumElements = SubArrayTy->getNumElements();
|
||||
for (++I; I != E && (isa<ArrayType>(*I) || isa<PackedType>(*I)); ++I) {
|
||||
uint64_t NumElements;
|
||||
if (const ArrayType *SubArrayTy = dyn_cast<ArrayType>(*I))
|
||||
NumElements = SubArrayTy->getNumElements();
|
||||
else
|
||||
NumElements = cast<PackedType>(*I)->getNumElements();
|
||||
|
||||
if (!isa<ConstantInt>(I.getOperand())) return 0;
|
||||
if (cast<ConstantInt>(I.getOperand())->getZExtValue() >= NumElements)
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue