[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Chris Lattner
sabre at nondot.org
Tue Nov 7 14:43:02 PST 2006
Changes in directory llvm/lib/Transforms/Scalar:
ScalarReplAggregates.cpp updated: 1.47 -> 1.48
---
Log message:
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
---
Diffs of the changes: (+7 -3)
ScalarReplAggregates.cpp | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.47 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.48
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.47 Thu Nov 2 14:25:50 2006
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Nov 7 16:42:47 2006
@@ -316,9 +316,13 @@
//
// 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;
More information about the llvm-commits
mailing list