[llvm] ea929a0 - [LV] Set inbounds flag using CreateGEP in vectorizeInterleaveGroup(NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 04:30:16 PDT 2023


Author: Florian Hahn
Date: 2023-03-22T11:29:57Z
New Revision: ea929a07b677406ae7bb42ae055a27b8606f088b

URL: https://github.com/llvm/llvm-project/commit/ea929a07b677406ae7bb42ae055a27b8606f088b
DIFF: https://github.com/llvm/llvm-project/commit/ea929a07b677406ae7bb42ae055a27b8606f088b.diff

LOG: [LV] Set inbounds flag using CreateGEP in vectorizeInterleaveGroup(NFC).

This avoids having to cast the result of the builder to
GetElementPtrInst.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 0b71d309c2975..58a80aa8025ec 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2659,8 +2659,8 @@ void InnerLoopVectorizer::vectorizeInterleaveGroup(
     bool InBounds = false;
     if (auto *gep = dyn_cast<GetElementPtrInst>(AddrPart->stripPointerCasts()))
       InBounds = gep->isInBounds();
-    AddrPart = Builder.CreateGEP(ScalarTy, AddrPart, Builder.getInt32(-Index));
-    cast<GetElementPtrInst>(AddrPart)->setIsInBounds(InBounds);
+    AddrPart = Builder.CreateGEP(ScalarTy, AddrPart, Builder.getInt32(-Index),
+                                 "", InBounds);
 
     // Cast to the vector pointer type.
     unsigned AddressSpace = AddrPart->getType()->getPointerAddressSpace();


        


More information about the llvm-commits mailing list