[PATCH] D42123: Derive GEP index type from Data Layout
Sanjoy Das via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 30 10:27:53 PST 2018
sanjoy added inline comments.
================
Comment at: ../lib/Analysis/ScalarEvolution.cpp:3667
bool ScalarEvolution::isSCEVable(Type *Ty) const {
// Integers and pointers are always SCEVable.
return Ty->isIntegerTy() || Ty->isPointerTy();
----------------
Generally speaking; the SCEV changes need to be tested.
================
Comment at: ../lib/Analysis/ScalarEvolution.cpp:3675
assert(isSCEVable(Ty) && "Type is not SCEVable!");
+ if (Ty->isPointerTy())
+ return getDataLayout().getIndexTypeSizeInBits(Ty);
----------------
I don't think this is a correct place to make this change -- the size of a pointer is the size of a pointer. I think you need to change the SCEV corresponding to GEP(Ptr, Idx) to be "sext(Ptr) + Idx" or "Ptr + sext(Idx)" depending on their relative sizes.
Repository:
rL LLVM
https://reviews.llvm.org/D42123
More information about the llvm-commits
mailing list