[PATCH] D14976: Fixed a failure in cost calculation for vector GEP
Jingyue Wu via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 25 09:49:14 PST 2015
jingyue added inline comments.
================
Comment at: ../include/llvm/Analysis/TargetTransformInfoImpl.h:421
@@ +420,3 @@
+ if (!ConstIdx)
+ if (auto Splat = getSplatValue(*I))
+ ConstIdx = dyn_cast<ConstantInt>(Splat);
----------------
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?
================
Comment at: ../lib/Analysis/VectorUtils.cpp:421
@@ -421,2 +420,3 @@
+const llvm::Value *llvm::getSplatValue(const Value *V) {
if (auto *CV = dyn_cast<ConstantDataVector>(V))
return CV->getSplatValue();
----------------
This if-check seems unnecessary. The one at Line 424 already checks for `ConstantDataVector`.
Repository:
rL LLVM
http://reviews.llvm.org/D14976
More information about the llvm-commits
mailing list