[llvm] 1674f77 - [VecotrCombine] Fix unused variable for assertion disabled builds

Kadir Cetinkaya via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 00:30:37 PST 2020


Author: Kadir Cetinkaya
Date: 2020-02-14T09:30:29+01:00
New Revision: 1674f772b4ea67f62cb93536143107ef2bd25b7f

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

LOG: [VecotrCombine] Fix unused variable for assertion disabled builds

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index a70d962a8f48..f5a26d012de9 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -107,8 +107,6 @@ static bool foldExtractBinop(Instruction &I, const TargetTransformInfo &TTI) {
   int VecBOCost = TTI.getArithmeticInstrCost(BOpcode, VecTy);
   int Extract0Cost = TTI.getVectorInstrCost(Instruction::ExtractElement,
                                             VecTy, C0);
-  int Extract1Cost = TTI.getVectorInstrCost(Instruction::ExtractElement,
-                                            VecTy, C1);
 
   // Handle a special case - if the extract indexes are the same, the
   // replacement sequence does not require a shuffle. Unless the vector binop is
@@ -116,7 +114,9 @@ static bool foldExtractBinop(Instruction &I, const TargetTransformInfo &TTI) {
   // Extra uses of the extracts mean that we include those costs in the
   // vector total because those instructions will not be eliminated.
   if (C0 == C1) {
-    assert(Extract0Cost == Extract1Cost && "Different costs for same extract?");
+    assert(Extract0Cost ==
+               TTI.getVectorInstrCost(Instruction::ExtractElement, VecTy, C1) &&
+           "Different costs for same extract?");
     int ExtractCost = Extract0Cost;
     if (X != Y) {
       int ScalarCost = ExtractCost + ExtractCost + ScalarBOCost;


        


More information about the llvm-commits mailing list