diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -1207,7 +1207,7 @@ // In practice it's not currently possible to have a change in lane // length for extending loads or truncating stores so both types should // have the same scalable property. - TypeSize::isKnownLT(Src->getPrimitiveSizeInBits(), + TypeSize::isKnownLT(DL.getTypeStoreSizeInBits(Src), LT.second.getSizeInBits())) { // This is a vector load that legalizes to a larger type than the vector // itself. Unless the corresponding extending load or truncating store is diff --git a/llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll b/llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll --- a/llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll +++ b/llvm/test/Analysis/CostModel/RISCV/rvv-load-store.ll @@ -58,16 +58,16 @@ ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %51 = load , ptr %p, align 128 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %52 = load , ptr %p, align 256 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %53 = load ptr, ptr %p, align 8 -; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %54 = load <1 x ptr>, ptr %p, align 8 -; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: %55 = load <2 x ptr>, ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %54 = load <1 x ptr>, ptr %p, align 8 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %55 = load <2 x ptr>, ptr %p, align 16 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %56 = load <4 x ptr>, ptr %p, align 32 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %57 = load <8 x ptr>, ptr %p, align 64 ; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %58 = load <16 x ptr>, ptr %p, align 128 ; CHECK-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %59 = load <32 x ptr>, ptr %p, align 256 -; CHECK-NEXT: Cost Model: Invalid cost for instruction: %60 = load , ptr %p, align 8 -; CHECK-NEXT: Cost Model: Invalid cost for instruction: %61 = load , ptr %p, align 16 -; CHECK-NEXT: Cost Model: Invalid cost for instruction: %62 = load , ptr %p, align 32 -; CHECK-NEXT: Cost Model: Invalid cost for instruction: %63 = load , ptr %p, align 64 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %60 = load , ptr %p, align 8 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %61 = load , ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %62 = load , ptr %p, align 32 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %63 = load , ptr %p, align 64 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %64 = load , ptr %p, align 128 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %65 = load , ptr %p, align 256 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void @@ -201,18 +201,18 @@ ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store undef, ptr %p, align 128 ; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store undef, ptr %p, align 256 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store ptr undef, ptr %p, align 8 -; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store <1 x ptr> undef, ptr %p, align 8 -; CHECK-NEXT: Cost Model: Found an estimated cost of 3 for instruction: store <2 x ptr> undef, ptr %p, align 16 -; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: store <4 x ptr> undef, ptr %p, align 32 -; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: store <8 x ptr> undef, ptr %p, align 64 -; CHECK-NEXT: Cost Model: Found an estimated cost of 24 for instruction: store <16 x ptr> undef, ptr %p, align 128 -; CHECK-NEXT: Cost Model: Found an estimated cost of 48 for instruction: store <32 x ptr> undef, ptr %p, align 256 -; CHECK-NEXT: Cost Model: Invalid cost for instruction: store undef, ptr %p, align 8 -; CHECK-NEXT: Cost Model: Invalid cost for instruction: store undef, ptr %p, align 16 -; CHECK-NEXT: Cost Model: Invalid cost for instruction: store undef, ptr %p, align 32 -; CHECK-NEXT: Cost Model: Invalid cost for instruction: store undef, ptr %p, align 64 -; CHECK-NEXT: Cost Model: Invalid cost for instruction: store undef, ptr %p, align 128 -; CHECK-NEXT: Cost Model: Invalid cost for instruction: store undef, ptr %p, align 256 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <1 x ptr> undef, ptr %p, align 8 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store <2 x ptr> undef, ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store <4 x ptr> undef, ptr %p, align 32 +; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store <8 x ptr> undef, ptr %p, align 64 +; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: store <16 x ptr> undef, ptr %p, align 128 +; CHECK-NEXT: Cost Model: Found an estimated cost of 16 for instruction: store <32 x ptr> undef, ptr %p, align 256 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store undef, ptr %p, align 8 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store undef, ptr %p, align 16 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store undef, ptr %p, align 32 +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: store undef, ptr %p, align 64 +; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: store undef, ptr %p, align 128 +; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store undef, ptr %p, align 256 ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; store i8 undef, ptr %p