aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/AutoUpgrade.cpp
diff options
context:
space:
mode:
authorWang Pengcheng <wangpengcheng.pp@bytedance.com>2024-04-16 21:27:31 +0800
committerWang Pengcheng <wangpengcheng.pp@bytedance.com>2024-04-16 21:27:31 +0800
commit36640769547bedf26ddf149132c1b75f9e088a21 (patch)
treeae7d210d8d7593f7bb672006e4a31f192a02b9c5 /llvm/lib/IR/AutoUpgrade.cpp
parentd72e50aae48ffed5fb6c1a9ad6bfc47c5ca93230 (diff)
parente7fb49c24e4be4780ee4df9829980c5e8ddd511e (diff)
downloadllvm-36640769547bedf26ddf149132c1b75f9e088a21.zip
llvm-36640769547bedf26ddf149132c1b75f9e088a21.tar.gz
llvm-36640769547bedf26ddf149132c1b75f9e088a21.tar.bz2
Created using spr 1.3.6-beta.1
Diffstat (limited to 'llvm/lib/IR/AutoUpgrade.cpp')
-rw-r--r--llvm/lib/IR/AutoUpgrade.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/IR/AutoUpgrade.cpp b/llvm/lib/IR/AutoUpgrade.cpp
index 2c480fb..634b2dd 100644
--- a/llvm/lib/IR/AutoUpgrade.cpp
+++ b/llvm/lib/IR/AutoUpgrade.cpp
@@ -5341,10 +5341,11 @@ MDNode *llvm::upgradeInstructionLoopAttachment(MDNode &N) {
std::string llvm::UpgradeDataLayoutString(StringRef DL, StringRef TT) {
Triple T(TT);
- // The only data layout upgrades needed for pre-GCN are setting the address
- // space of globals to 1.
- if (T.isAMDGPU() && !T.isAMDGCN() && !DL.contains("-G") &&
- !DL.starts_with("G")) {
+ // The only data layout upgrades needed for pre-GCN, SPIR or SPIRV are setting
+ // the address space of globals to 1. This does not apply to SPIRV Logical.
+ if (((T.isAMDGPU() && !T.isAMDGCN()) ||
+ (T.isSPIR() || (T.isSPIRV() && !T.isSPIRVLogical()))) &&
+ !DL.contains("-G") && !DL.starts_with("G")) {
return DL.empty() ? std::string("G1") : (DL + "-G1").str();
}