aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorKoakuma <koachan@protonmail.com>2024-09-30 08:32:33 +0700
committerGitHub <noreply@github.com>2024-09-30 08:32:33 +0700
commitdbad963a69fd7b16c6838f81b61167fbf00a413c (patch)
tree7bbab49c416d0db17dd5d8bfbfe7d94daed02314 /llvm/lib/IR/AutoUpgrade.cpp
parent129ade21bdad5f09206b773cd0591a9616ad0ca4 (diff)
downloadllvm-dbad963a69fd7b16c6838f81b61167fbf00a413c.zip
llvm-dbad963a69fd7b16c6838f81b61167fbf00a413c.tar.gz
llvm-dbad963a69fd7b16c6838f81b61167fbf00a413c.tar.bz2
[SPARC] Align i128 to 16 bytes in SPARC datalayouts (#106951)
Align i128s to 16 bytes, following the example at https://reviews.llvm.org/D86310. clang already does this implicitly, but do it in backend code too for the benefit of other frontends (see e.g https://github.com/llvm/llvm-project/issues/102783 & https://github.com/rust-lang/rust/issues/128950).
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index b842583..6f833ac 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -5517,6 +5517,18 @@ std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
return Res;
}
+ if (T.isSPARC()) {
+ // Add "-i128:128"
+ std::string I64 = "-i64:64";
+ 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);
+ }
+ return Res;
+ }
+
if (!T.isX86())
return Res;