mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-18 14:31:27 +00:00
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31524 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
03507f53c4
commit
d92515034f
@ -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…
x
Reference in New Issue
Block a user