[PATCH] D117270: Revert "[X86][LLD] Update datelayout in LLD tests. NFCI"

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 13 19:50:40 PST 2022


pengfei created this revision.
pengfei added reviewers: rnk, craig.topper, efriedma, gbreynoo.
Herald added subscribers: ormris, dexonsmith, steven_wu, hiraditya.
pengfei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This reverts commit 9b43237128da0a7a3bc8a16f6f2c0897b9e842be <https://reviews.llvm.org/rG9b43237128da0a7a3bc8a16f6f2c0897b9e842be>

The reverted patch is a workaround to make buildbot happy.
This fixes the real problem in rG1bb0caf56168 <https://reviews.llvm.org/rG1bb0caf561688681be67cc91560348c9e43fcbf3>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117270

Files:
  lld/test/COFF/libcall-archive.ll
  lld/test/COFF/lto-lazy-reference.ll
  lld/test/COFF/lto-reloc-model.ll
  llvm/lib/IR/AutoUpgrade.cpp
  llvm/test/Bitcode/upgrade-datalayout4.ll


Index: llvm/test/Bitcode/upgrade-datalayout4.ll
===================================================================
--- /dev/null
+++ llvm/test/Bitcode/upgrade-datalayout4.ll
@@ -0,0 +1,8 @@
+; Test to make sure datalayout is automatically upgraded.
+;
+; RUN: llvm-as %s -o - | llvm-dis - | FileCheck %s
+
+target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
+target triple = "i686-pc-windows-msvc"
+
+; CHECK: target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32-a:0:32-S32"
Index: llvm/lib/IR/AutoUpgrade.cpp
===================================================================
--- llvm/lib/IR/AutoUpgrade.cpp
+++ llvm/lib/IR/AutoUpgrade.cpp
@@ -4570,16 +4570,18 @@
   }
 
   std::string Res = DL.str();
-  std::string AddrSpaces = "-p270:32:32-p271:32:32-p272:64:64";
-  // If X86, and the datalayout matches the expected format, add pointer size
-  // address spaces to the datalayout.
-  if (!T.isX86() || DL.contains(AddrSpaces))
+  if (!T.isX86())
     return Res;
 
-  SmallVector<StringRef, 4> Groups;
-  Regex R("(e-m:[a-z](-p:32:32)?)(-[if]64:.*$)");
-  if (R.match(DL, &Groups))
-    Res = (Groups[1] + AddrSpaces + Groups[3]).str();
+  // If the datalayout matches the expected format, add pointer size address
+  // spaces to the datalayout.
+  std::string AddrSpaces = "-p270:32:32-p271:32:32-p272:64:64";
+  if (!DL.contains(AddrSpaces)) {
+    SmallVector<StringRef, 4> Groups;
+    Regex R("(e-m:[a-z](-p:32:32)?)(-[if]64:.*$)");
+    if (R.match(DL, &Groups))
+      Res = (Groups[1] + AddrSpaces + Groups[3]).str();
+  }
 
   // For 32-bit MSVC targets, raise the alignment of f80 values to 16 bytes.
   // Raising the alignment is safe because Clang did not produce f80 values in
Index: lld/test/COFF/lto-reloc-model.ll
===================================================================
--- lld/test/COFF/lto-reloc-model.ll
+++ lld/test/COFF/lto-reloc-model.ll
@@ -3,7 +3,7 @@
 ; RUN: lld-link /entry:main /subsystem:console /out:%t.exe %t
 ; RUN: llvm-objdump -d %t.exe | FileCheck %s
 
-target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32-a:0:32-S32"
+target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
 target triple = "i686-pc-windows-msvc"
 
 @foo = thread_local global i8 0
Index: lld/test/COFF/lto-lazy-reference.ll
===================================================================
--- lld/test/COFF/lto-lazy-reference.ll
+++ lld/test/COFF/lto-lazy-reference.ll
@@ -6,7 +6,7 @@
 ; RUN: llvm-as -o %t.obj %s
 ; RUN: lld-link /out:%t.exe /entry:main /subsystem:console %t.obj %t.lib
 
-target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32-a:0:32-S32"
+target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
 target triple = "i686-pc-windows-msvc18.0.0"
 
 ; Define fltused, since we don't link against the MS C runtime but are
Index: lld/test/COFF/libcall-archive.ll
===================================================================
--- lld/test/COFF/libcall-archive.ll
+++ lld/test/COFF/libcall-archive.ll
@@ -10,7 +10,7 @@
 ; CHECK: _start
 ; CHECK: _memcpy
 
-target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32-a:0:32-S32"
+target datalayout = "e-m:x-p:32:32-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:32-n8:16:32-a:0:32-S32"
 target triple = "i686-unknown-windows"
 
 define void @start(i8* %a, i8* %b) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117270.399874.patch
Type: text/x-patch
Size: 3551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220114/eaac0857/attachment.bin>


More information about the llvm-commits mailing list