[llvm] d682a36 - [SLP] Merge null and dyn_cast<> checks into dyn_cast_or_null<>. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 06:02:18 PDT 2020


Author: Simon Pilgrim
Date: 2020-09-22T14:01:47+01:00
New Revision: d682a36ef9dace4887c42d392110ea21eb9e31a6

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

LOG: [SLP] Merge null and dyn_cast<> checks into dyn_cast_or_null<>. NFCI.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 5fad74090489..8f73d5ccc472 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -7421,9 +7421,7 @@ static bool tryToVectorizeHorReductionOrInstOperands(
 bool SLPVectorizerPass::vectorizeRootInstruction(PHINode *P, Value *V,
                                                  BasicBlock *BB, BoUpSLP &R,
                                                  TargetTransformInfo *TTI) {
-  if (!V)
-    return false;
-  auto *I = dyn_cast<Instruction>(V);
+  auto *I = dyn_cast_or_null<Instruction>(V);
   if (!I)
     return false;
 


        


More information about the llvm-commits mailing list