[llvm] 2267191 - [LV] Add missing check, drop 'then'.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 07:21:57 PDT 2024


Author: Florian Hahn
Date: 2024-07-11T15:21:33+01:00
New Revision: 22671910721ecbe89e14649f42ab0e7f9feb575f

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

LOG: [LV] Add missing check, drop 'then'.

Address post-commit comments for 67f4968a577.

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 b12ac513470ca..7cae0ed0f9478 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -7003,10 +7003,11 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
         VectorTy->isVectorTy() ? ToVectorTy(SrcScalarTy, VF) : SrcScalarTy;
 
     if (canTruncateToMinimalBitwidth(I, VF)) {
-      // If the result type is <= then the source type, there will be no extend
+      // If the result type is <= the source type, there will be no extend
       // after truncating the users to the minimal required bitwidth.
       if (VectorTy->getScalarSizeInBits() <= SrcVecTy->getScalarSizeInBits() &&
-          (I->getOpcode() == Instruction::ZExt || I->getOpcode()))
+          (I->getOpcode() == Instruction::ZExt ||
+           I->getOpcode() == Instruction::SExt))
         return 0;
     }
 


        


More information about the llvm-commits mailing list