[llvm] 1952c86 - [AArch64][CostModel] getCastInstrCost

Sam Parker via llvm-commits llvm-commits at lists.llvm.org
Tue May 12 02:04:59 PDT 2020


Author: Sam Parker
Date: 2020-05-12T10:02:29+01:00
New Revision: 1952c86d6146b107770c28e9444d1b35d5dfe58d

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

LOG: [AArch64][CostModel] getCastInstrCost

Pass the instruction to the base implementation.

Differential Revision: https://reviews.llvm.org/D79562

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
    llvm/test/Analysis/CostModel/AArch64/cast.ll
    llvm/test/Transforms/SLPVectorizer/AArch64/horizontal.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index 0c0b3d6407eb..1324945c4d4e 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -299,7 +299,7 @@ int AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
   EVT DstTy = TLI->getValueType(DL, Dst);
 
   if (!SrcTy.isSimple() || !DstTy.isSimple())
-    return BaseT::getCastInstrCost(Opcode, Dst, Src, CostKind);
+    return BaseT::getCastInstrCost(Opcode, Dst, Src, CostKind, I);
 
   static const TypeConversionCostTblEntry
   ConversionTbl[] = {
@@ -403,7 +403,7 @@ int AArch64TTIImpl::getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
                                                  SrcTy.getSimpleVT()))
     return Entry->Cost;
 
-  return BaseT::getCastInstrCost(Opcode, Dst, Src, CostKind);
+  return BaseT::getCastInstrCost(Opcode, Dst, Src, CostKind, I);
 }
 
 int AArch64TTIImpl::getExtractWithExtendCost(unsigned Opcode, Type *Dst,

diff  --git a/llvm/test/Analysis/CostModel/AArch64/cast.ll b/llvm/test/Analysis/CostModel/AArch64/cast.ll
index cbb743ee0136..a21bb779e312 100644
--- a/llvm/test/Analysis/CostModel/AArch64/cast.ll
+++ b/llvm/test/Analysis/CostModel/AArch64/cast.ll
@@ -586,17 +586,17 @@ define i32 @load_extends() {
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %loadv2i16 = load <2 x i16>, <2 x i16>* undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %loadv4i16 = load <4 x i16>, <4 x i16>* undef
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %loadv2i32 = load <2 x i32>, <2 x i32>* undef
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r0 = sext i8 %loadi8 to i16
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r1 = zext i8 %loadi8 to i16
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r2 = sext i8 %loadi8 to i32
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r3 = zext i8 %loadi8 to i32
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r4 = sext i8 %loadi8 to i64
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r0 = sext i8 %loadi8 to i16
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r1 = zext i8 %loadi8 to i16
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r2 = sext i8 %loadi8 to i32
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r3 = zext i8 %loadi8 to i32
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r4 = sext i8 %loadi8 to i64
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r5 = zext i8 %loadi8 to i64
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r6 = sext i16 %loadi16 to i32
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r7 = zext i16 %loadi16 to i32
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r8 = sext i16 %loadi16 to i64
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r6 = sext i16 %loadi16 to i32
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r7 = zext i16 %loadi16 to i32
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r8 = sext i16 %loadi16 to i64
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r9 = zext i16 %loadi16 to i64
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %r10 = sext i32 %loadi32 to i64
+; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r10 = sext i32 %loadi32 to i64
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 0 for instruction: %r11 = zext i32 %loadi32 to i64
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v0 = sext <8 x i8> %loadv8i8 to <8 x i16>
 ; CHECK-NEXT:  Cost Model: Found an estimated cost of 1 for instruction: %v1 = zext <8 x i8> %loadv8i8 to <8 x i16>

diff  --git a/llvm/test/Transforms/SLPVectorizer/AArch64/horizontal.ll b/llvm/test/Transforms/SLPVectorizer/AArch64/horizontal.ll
index b3ce90dabd84..ab07e8c248a0 100644
--- a/llvm/test/Transforms/SLPVectorizer/AArch64/horizontal.ll
+++ b/llvm/test/Transforms/SLPVectorizer/AArch64/horizontal.ll
@@ -244,7 +244,7 @@ for.end:                                          ; preds = %for.end.loopexit, %
 ; YAML-NEXT: Function:        test_unrolled_select
 ; YAML-NEXT: Args:
 ; YAML-NEXT:   - String:          'Vectorized horizontal reduction with cost '
-; YAML-NEXT:   - Cost:            '-47'
+; YAML-NEXT:   - Cost:            '-31'
 ; YAML-NEXT:   - String:          ' and with tree size '
 ; YAML-NEXT:   - TreeSize:        '10'
 


        


More information about the llvm-commits mailing list