Cost calculation for vector GEP failed with due to invalid cast to GEP index operand.
The bug is fixed, added a test.
Details
- Reviewers
gilr
Diff Detail
- Repository
- rL LLVM
Event Timeline
../include/llvm/Analysis/TargetTransformInfoImpl.h | ||
---|---|---|
421 | I don't understand why you use getSplatValue here. getSplatValue returns the element type only when all the elements in the array/vector are the same. Are you supposed to also protect the cases where the elements are different? | |
../lib/Analysis/VectorUtils.cpp | ||
419–420 | This if-check seems unnecessary. The one at Line 424 already checks for ConstantDataVector. |
../include/llvm/Analysis/TargetTransformInfoImpl.h | ||
---|---|---|
421 | It may be a vector of constants. In this case the ConstIdx = 0. | |
../lib/Analysis/VectorUtils.cpp | ||
419–420 | Constant and ConstantDataVector are different types. In case of all-zero-vector it is "Constant". |
LGTM with some minors
../include/llvm/Analysis/TargetTransformInfoImpl.h | ||
---|---|---|
421 | It makes sense now. Please add a comment explaining why we need to use getSplatValue. Thanks! | |
../lib/Analysis/VectorUtils.cpp | ||
419–420 | http://llvm.org/docs/doxygen/html/Constants_8cpp_source.html#l01435 ConstantDataVector is a subclass of Constant. Constant::getSplatValue checks if the constant is a ConstantDataVector and if so invokes ConstantDataVector::getSplatValue. So I think it's no longer necessary to check for ConstantDataVector in Line 421-422. |
I don't understand why you use getSplatValue here. getSplatValue returns the element type only when all the elements in the array/vector are the same. Are you supposed to also protect the cases where the elements are different?