[llvm] 0fa6130 - [LoopVectorize] Relax a FCmpInst assert to dyn_cast after D95690

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 19:28:53 PST 2021


Author: Fangrui Song
Date: 2021-02-01T19:28:45-08:00
New Revision: 0fa61304d247a61b151cceac70e805abc69f8c1d

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

LOG: [LoopVectorize] Relax a FCmpInst assert to dyn_cast after D95690

The instruction may be `icmp eq i32`. Noticed in an internal Halide+wasm JIT test.

Added: 
    

Modified: 
    llvm/lib/Analysis/IVDescriptors.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/IVDescriptors.cpp b/llvm/lib/Analysis/IVDescriptors.cpp
index 91befad26de5..64b55b85f3a1 100644
--- a/llvm/lib/Analysis/IVDescriptors.cpp
+++ b/llvm/lib/Analysis/IVDescriptors.cpp
@@ -309,8 +309,8 @@ bool RecurrenceDescriptor::AddReductionVar(PHINode *Phi, RecurKind Kind,
           // TODO: This is a hack to work-around the fact that FMF may not be
           //       assigned/propagated correctly. If that problem is fixed or we
           //       standardize on fmin/fmax via intrinsics, this can be removed.
-          assert(isa<FCmpInst>(Sel->getCondition()) && "Expected fcmp min/max");
-          CurFMF |= cast<FCmpInst>(Sel->getCondition())->getFastMathFlags();
+          if (auto *FCmp = dyn_cast<FCmpInst>(Sel->getCondition()))
+            CurFMF |= FCmp->getFastMathFlags();
         }
         FMF &= CurFMF;
       }


        


More information about the llvm-commits mailing list