aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorKoakuma <koachan@protonmail.com>2024-10-03 05:20:56 +0700
committerGitHub <noreply@github.com>2024-10-03 05:20:56 +0700
commit076392b0aac2b4d2aed243adb4b35aba2603512c (patch)
treee0bb33c94cb2e23c20e013e90ab86d55beb9ce1d /llvm/lib/IR/AutoUpgrade.cpp
parent41eb186fbb024898bacc2577fa3b88db0510ba1f (diff)
downloadllvm-076392b0aac2b4d2aed243adb4b35aba2603512c.zip
llvm-076392b0aac2b4d2aed243adb4b35aba2603512c.tar.gz
llvm-076392b0aac2b4d2aed243adb4b35aba2603512c.tar.bz2
[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.
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 6f833ac..d3e274f 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;
}