[llvm] 076392b - [SPARC] Fix regression from UpgradeDataLayoutString change (#110608)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 2 15:20:59 PDT 2024
Author: Koakuma
Date: 2024-10-03T05:20:56+07:00
New Revision: 076392b0aac2b4d2aed243adb4b35aba2603512c
URL: https://github.com/llvm/llvm-project/commit/076392b0aac2b4d2aed243adb4b35aba2603512c
DIFF: https://github.com/llvm/llvm-project/commit/076392b0aac2b4d2aed243adb4b35aba2603512c.diff
LOG: [SPARC] Fix regression from UpgradeDataLayoutString change (#110608)
It turns out that we cannot rely on the presence of `-i64:64` as a
position reference when adding the `-i128:128` datalayout string due to
some custom datalayout strings lacking it (e.g ones used by bugpoint,
among other things).
Do not add the `-i128:128` string in that case.
This fixes the regression introduced in
https://github.com/llvm/llvm-project/pull/106951.
Added:
Modified:
llvm/lib/IR/AutoUpgrade.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 6f833acd6dbc0d..d3e274f4e623da 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -5523,8 +5523,8 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
std::string I128 = "-i128:128";
if (!StringRef(Res).contains(I128)) {
size_t Pos = Res.find(I64);
- assert(Pos != size_t(-1) && "no i64 data layout found!");
- Res.insert(Pos + I64.size(), I128);
+ if (Pos != size_t(-1))
+ Res.insert(Pos + I64.size(), I128);
}
return Res;
}
More information about the llvm-commits
mailing list