[llvm] b0797e0 - [SLP] use dyn_cast instead of isa + cast; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 26 10:52:38 PDT 2021


Author: Sanjay Patel
Date: 2021-03-26T13:52:31-04:00
New Revision: b0797e0c12f94fe7dcb8ba16c90edc527a592b0c

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

LOG: [SLP] use dyn_cast instead of isa + cast; NFC

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 a99089311679..516a803fd5ca 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -7098,10 +7098,9 @@ class HorizontalReduction {
       // select, we also have to RAUW for the compare instruction feeding the
       // reduction root. That's because the original compare may have extra uses
       // besides the final select of the reduction.
-      if (isa<SelectInst>(ReductionRoot)) {
+      if (auto *ScalarSelect = dyn_cast<SelectInst>(ReductionRoot)) {
         if (auto *VecSelect = dyn_cast<SelectInst>(VectorizedTree)) {
-          Instruction *ScalarCmp =
-              getCmpForMinMaxReduction(cast<Instruction>(ReductionRoot));
+          Instruction *ScalarCmp = getCmpForMinMaxReduction(ScalarSelect);
           ScalarCmp->replaceAllUsesWith(VecSelect->getCondition());
         }
       }


        


More information about the llvm-commits mailing list