[PATCH] D83461: [SVE] Fix implicit TypeSize->uint64_t conversion in getCastInstrCost
David Sherwood via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 14 00:16:54 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc06b7e2ab516: [SVE] Fix implicit TypeSize->uint64_t conversion getCastInstrCost (authored by david-arm).
Changed prior to commit:
https://reviews.llvm.org/D83461?vs=276652&id=277682#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D83461/new/
https://reviews.llvm.org/D83461
Files:
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/test/Analysis/CostModel/AArch64/sve-bitcast.ll
Index: llvm/test/Analysis/CostModel/AArch64/sve-bitcast.ll
===================================================================
--- /dev/null
+++ llvm/test/Analysis/CostModel/AArch64/sve-bitcast.ll
@@ -0,0 +1,12 @@
+; RUN: opt -mtriple=aarch64-linux-gnu -mattr=+sve -cost-model -analyze < %s 2>%t | FileCheck %s
+; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t
+
+; If this check fails please read test/CodeGen/aarch64-sve-intrinsics/README for instructions on how to resolve it.
+; WARN-NOT: warning
+
+; CHECK: Found an estimated cost of 0 for instruction: %b = bitcast <vscale x 2 x double> %a to <vscale x 2 x i64>
+
+define <vscale x 2 x i64> @foo(<vscale x 2 x double> %a, i32 %x) {
+ %b = bitcast <vscale x 2 x double> %a to <vscale x 2 x i64>
+ ret <vscale x 2 x i64> %b
+}
Index: llvm/include/llvm/CodeGen/BasicTTIImpl.h
===================================================================
--- llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -702,8 +702,8 @@
std::pair<unsigned, MVT> SrcLT = TLI->getTypeLegalizationCost(DL, Src);
std::pair<unsigned, MVT> DstLT = TLI->getTypeLegalizationCost(DL, Dst);
- unsigned SrcSize = SrcLT.second.getSizeInBits();
- unsigned DstSize = DstLT.second.getSizeInBits();
+ TypeSize SrcSize = SrcLT.second.getSizeInBits();
+ TypeSize DstSize = DstLT.second.getSizeInBits();
bool IntOrPtrSrc = Src->isIntegerTy() || Src->isPointerTy();
bool IntOrPtrDst = Dst->isIntegerTy() || Dst->isPointerTy();
@@ -777,8 +777,7 @@
// Check vector-to-vector casts.
if (DstVTy && SrcVTy) {
// If the cast is between same-sized registers, then the check is simple.
- if (SrcLT.first == DstLT.first &&
- SrcLT.second.getSizeInBits() == DstLT.second.getSizeInBits()) {
+ if (SrcLT.first == DstLT.first && SrcSize == DstSize) {
// Assume that Zext is done using AND.
if (Opcode == Instruction::ZExt)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83461.277682.patch
Type: text/x-patch
Size: 1966 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200714/c7982ef9/attachment.bin>
More information about the llvm-commits
mailing list