[llvm] 2437784 - [LV] Replace unreachable by folding into else with assert (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 21:47:09 PDT 2024


Author: Florian Hahn
Date: 2024-10-21T21:46:48-07:00
New Revision: 2437784a178adb299cf6e363427e98611e3d2460

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

LOG: [LV] Replace unreachable by folding into else with assert (NFC).

Simplify code as suggested post-commit in
https://github.com/llvm/llvm-project/pull/110576/.

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 a88989aa2829b1..60a94ca1f86e42 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -2795,14 +2795,14 @@ void InnerLoopVectorizer::fixupIVUsers(PHINode *OrigPhi,
         Escape = B.CreateSub(EndValue, Step);
       else if (EndValue->getType()->isPointerTy())
         Escape = B.CreatePtrAdd(EndValue, B.CreateNeg(Step));
-      else if (EndValue->getType()->isFloatingPointTy()) {
+      else {
+        assert(EndValue->getType()->isFloatingPointTy() &&
+               "Unexpected induction type");
         Escape = B.CreateBinOp(II.getInductionBinOp()->getOpcode() ==
                                        Instruction::FAdd
                                    ? Instruction::FSub
                                    : Instruction::FAdd,
                                EndValue, Step);
-      } else {
-        llvm_unreachable("all possible induction types must be handled");
       }
       Escape->setName("ind.escape");
       MissingVals[UI] = Escape;


        


More information about the llvm-commits mailing list