[PATCH] D46191: [LV] Preserve inbounds on created GEPs

Hideki Saito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 13:56:16 PDT 2018


hsaito added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:3138
         Value *MaskPart = isMaskRequired ? Mask[Part] : nullptr;
         Value *VectorGep = getOrCreateVectorValue(Ptr, Part);
         NewSI = Builder.CreateMaskedScatter(StoredVal, VectorGep, Alignment,
----------------
dneilson wrote:
> hsaito wrote:
> > While you are at this, please look into whether isInbounds() is supported for vector gep. Whether anyone uses that is a different question, but losing information unnecessarily is sad. Same for Load side.
> Unless I've overlooked something, getOrCreateVectorValue() doesn't create GEPs (contrary to the name of the var it's being saved into). Looks like it does some sort of cache lookups, and if those fail then it creates actual vectors (splat or series of insertelements).
> 
> The only other GEP creation I see is in vectorizeInterleaveGroup() -- which looks like it could have the same issue as this PR.
Looks like vector GEP already had InBounds. That answers my question.

        // Create the new GEP. Note that this GEP may be a scalar if VF == 1,    
        // but it should be a vector, otherwise.                                 
        auto *NewGEP = GEP->isInBounds() 
                           ? Builder.CreateInBoundsGEP(Ptr, Indices) 
                           : Builder.CreateGEP(Ptr, Indices); 



Repository:
  rL LLVM

https://reviews.llvm.org/D46191





More information about the llvm-commits mailing list