[llvm] 30e53b8 - [LV] Sink module variable and use State to set it in widenCall. (NFC)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 18 11:42:21 PDT 2022


Author: Florian Hahn
Date: 2022-07-18T19:41:48+01:00
New Revision: 30e53b8c03d382fe9d2299189deebacbf97abe9f

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

LOG: [LV] Sink module variable and use State to set it in widenCall. (NFC)

Limits the lifetime of the variable and makes it independent of
CallInst.

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 800e9197d0952..1af749a28b38c 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4202,7 +4202,6 @@ void InnerLoopVectorizer::widenCallInstruction(CallInst &I, VPValue *Def,
          "DbgInfoIntrinsic should have been dropped during VPlan construction");
   State.setDebugLocFromInst(&I);
 
-  Module *M = I.getParent()->getParent()->getParent();
   auto *CI = cast<CallInst>(&I);
 
   SmallVector<Type *, 4> Tys;
@@ -4245,6 +4244,7 @@ void InnerLoopVectorizer::widenCallInstruction(CallInst &I, VPValue *Def,
       // Use vector version of the intrinsic.
       if (VF.isVector())
         TysForDecl[0] = VectorType::get(CI->getType()->getScalarType(), VF);
+      Module *M = State.Builder.GetInsertBlock()->getModule();
       VectorF = Intrinsic::getDeclaration(M, ID, TysForDecl);
       assert(VectorF && "Can't retrieve vector intrinsic.");
     } else {


        


More information about the llvm-commits mailing list