This commit is contained in:
Tulio Magno Quites Machado Filho 2023-07-31 17:19:01 -03:00 committed by root
parent a7e5ce65f5
commit 5ed8b2172a
3 changed files with 59 additions and 1 deletions

6
.llvm.metadata Normal file
View File

@ -0,0 +1,6 @@
072d2fb4b10f95d06189de00eb7f7e9b35c54e9a llvm-16.0.6.src.tar.xz
bfc74b3868c69ce674a583c91e938b6d4cf0fded llvm-16.0.6.src.tar.xz.sig
0de534cfef38697e115c3ae80634765f05e78e5b cmake-16.0.6.src.tar.xz
2db5c88fe9277bb0fa85f49b58e946e49ff235c2 cmake-16.0.6.src.tar.xz.sig
5b1a58de6ed9d154a38edb6386a5749576e0b96a third-party-16.0.6.src.tar.xz
51ad6a8ccc5ccd40faff6f1c98a2f33a9b600f88 third-party-16.0.6.src.tar.xz.sig

46
D156379.diff Normal file
View File

@ -0,0 +1,46 @@
diff --git a/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp b/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
--- a/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp
@@ -1152,6 +1152,11 @@
}
}
+ // Type legalization (via getNumberOfParts) can't handle structs
+ if (TLI->getValueType(DL, Src, true) == MVT::Other)
+ return BaseT::getMemoryOpCost(Opcode, Src, Alignment, AddressSpace,
+ CostKind);
+
unsigned NumOps =
(Src->isVectorTy() ? getNumVectorRegs(Src) : getNumberOfParts(Src));
diff --git a/llvm/test/Analysis/CostModel/SystemZ/struct-cost-crash.ll b/llvm/test/Analysis/CostModel/SystemZ/struct-cost-crash.ll
new file mode 100644
--- /dev/null
+++ b/llvm/test/Analysis/CostModel/SystemZ/struct-cost-crash.ll
@@ -0,0 +1,25 @@
+; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 2
+; RUN: opt -passes="print<cost-model>" 2>&1 -disable-output < %s | FileCheck %s
+;
+; Check that SystemZTTIImpl::getMemoryOpCost doesn't try to legalize structs,
+; which was failing llvm_unreachable in MVT::getVT.
+
+target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
+target triple = "s390x-unknown-linux-gnu"
+
+declare { i64, i32 } @bar()
+
+define i8 @foo() {
+; CHECK-LABEL: 'foo'
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: br label %1
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %2 = call { i64, i32 } @bar()
+; CHECK-NEXT: Cost Model: Found an estimated cost of 4 for instruction: store { i64, i32 } %2, ptr inttoptr (i64 16 to ptr), align 16
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: br label %1
+;
+ br label %1
+
+1: ; preds = %1, %0
+ %2 = call { i64, i32 } @bar()
+ store { i64, i32 } %2, ptr inttoptr (i64 16 to ptr), align 16
+ br label %1
+}

View File

@ -101,7 +101,7 @@
Name: %{pkg_name}
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}
Release: 2%{?dist}
Release: 3%{?dist}
Summary: The Low Level Virtual Machine
License: Apache-2.0 WITH LLVM-exception OR NCSA
@ -125,6 +125,9 @@ Patch101: 0001-Deactivate-markdown-doc.patch
Patch1: 0001-SystemZ-Improve-error-messages-for-unsupported-reloc.patch
# See https://reviews.llvm.org/D137890 for the next two patches
Patch2: 0001-llvm-Add-install-targets-for-gtest.patch
# Backport of https://reviews.llvm.org/D156379 from LLVM 18.
Patch3: D156379.diff
# Patching third-party dir with a 200 offset in patch number
Patch201: 0201-third-party-Add-install-targets-for-gtest.patch
@ -646,6 +649,9 @@ fi
%endif
%changelog
* Thu Aug 03 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.6-3
- Fix rhbz #2228944
* Wed Jul 19 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.6-2
- Improve error messages for unsupported relocs on s390x (rhbz#2216906)
- Disable LLVM_UNREACHABLE_OPTIMIZE