[LV] Set inbounds flag using CreateGEP in vectorizeInterleaveGroup(NFC).
authorFlorian Hahn <flo@fhahn.com>
Wed, 22 Mar 2023 11:28:49 +0000 (11:28 +0000)
committerFlorian Hahn <flo@fhahn.com>
Wed, 22 Mar 2023 11:29:57 +0000 (11:29 +0000)
This avoids having to cast the result of the builder to
GetElementPtrInst.

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

index 0b71d309c297579b51d0cc3dcd9628c395d7f7c1..58a80aa8025ec5a8f898b68e6317b52a5eef8abf 100644 (file)
@@ -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();