[clang] 645f6dc - [ThinLTO][AIX] Enable thinlto on AIX

Wael Yehia via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 19 10:37:24 PDT 2023


Author: Wael Yehia
Date: 2023-07-19T17:37:15Z
New Revision: 645f6dcd69a5315dbe2a6b49fdd8d356512544e8

URL: https://github.com/llvm/llvm-project/commit/645f6dcd69a5315dbe2a6b49fdd8d356512544e8
DIFF: https://github.com/llvm/llvm-project/commit/645f6dcd69a5315dbe2a6b49fdd8d356512544e8.diff

LOG: [ThinLTO][AIX] Enable thinlto on AIX

Starting from AIX 7.2 TL5 SP6 and AIX 7.3 TL2 the system linker supports thinLTO.

Reviewed By: ZarkoCA, MaskRay

Differential Revision: https://reviews.llvm.org/D155700

Added: 
    

Modified: 
    clang/lib/Driver/Driver.cpp
    clang/lib/Driver/ToolChains/CommonArgs.cpp
    clang/test/CodeGen/thinlto-backend-option.ll
    clang/test/CodeGen/thinlto-emit-llvm.c
    clang/test/Driver/thinlto_backend.c
    clang/test/Integration/thinlto_profile_sample_accurate.c

Removed: 
    clang/test/Driver/aix-unsupported-features.c


################################################################################
diff  --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index ce40df21c708dd..fc52f47df00b5d 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -4830,8 +4830,6 @@ void Driver::BuildJobs(Compilation &C) const {
   }
 
   const llvm::Triple &RawTriple = C.getDefaultToolChain().getTriple();
-  if (RawTriple.isOSAIX() && LTOMode == LTOK_Thin)
-    Diag(diag::err_drv_clang_unsupported) << "thinLTO on AIX";
 
   // Collect the list of architectures.
   llvm::StringSet<> ArchNames;

diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index cc958d7376b626..358d7565f47c2e 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -671,8 +671,11 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
     CmdArgs.push_back(Args.MakeArgString(
         Twine(PluginOptPrefix) + "dwo_dir=" + Output.getFilename() + "_dwo"));
 
-  if (IsThinLTO)
+  if (IsThinLTO && !IsOSAIX)
     CmdArgs.push_back(Args.MakeArgString(Twine(PluginOptPrefix) + "thinlto"));
+  else if (IsThinLTO && IsOSAIX)
+    CmdArgs.push_back(Args.MakeArgString(Twine("-bdbg:thinlto")));
+
 
   StringRef Parallelism = getLTOParallelism(Args, D);
   if (!Parallelism.empty())

diff  --git a/clang/test/CodeGen/thinlto-backend-option.ll b/clang/test/CodeGen/thinlto-backend-option.ll
index 5490d018dede2b..b25b584a2fe1c6 100644
--- a/clang/test/CodeGen/thinlto-backend-option.ll
+++ b/clang/test/CodeGen/thinlto-backend-option.ll
@@ -6,8 +6,6 @@
 ; scenario independent of any particular backend options that may exist now or
 ; in the future.
 
-; XFAIL: target={{.*}}-aix{{.*}}
-
 ; RUN: %clang -flto=thin -c -o %t.o %s
 ; RUN: llvm-lto -thinlto -o %t %t.o
 ; RUN: not %clang_cc1 -x ir %t.o -fthinlto-index=%t.thinlto.bc -mllvm -nonexistent -emit-obj -o /dev/null 2>&1 | FileCheck %s -check-prefix=UNKNOWN

diff  --git a/clang/test/CodeGen/thinlto-emit-llvm.c b/clang/test/CodeGen/thinlto-emit-llvm.c
index ce50b38bb4c6bc..de66b12fef202c 100644
--- a/clang/test/CodeGen/thinlto-emit-llvm.c
+++ b/clang/test/CodeGen/thinlto-emit-llvm.c
@@ -1,5 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
-
 // Test to ensure -emit-llvm and -emit-llvm-bc work when invoking the
 // ThinLTO backend path.
 // RUN: %clang -O2 %s -flto=thin -c -o %t.o

diff  --git a/clang/test/Driver/aix-unsupported-features.c b/clang/test/Driver/aix-unsupported-features.c
deleted file mode 100644
index 0004575a223ae3..00000000000000
--- a/clang/test/Driver/aix-unsupported-features.c
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: %clang -target powerpc-ibm-aix-xcoff -### -flto=thin 2>&1 %s | \
-// RUN:   FileCheck --check-prefix=CHECKTHINLTO %s
-// RUN: %clang -target powerpc64-ibm-aix-xcoff -### -flto=thin 2>&1 %s | \
-// RUN:   FileCheck --check-prefix=CHECKTHINLTO %s
-
-// CHECKTHINLTO: error: the clang compiler does not support 'thinLTO on AIX'
-

diff  --git a/clang/test/Driver/thinlto_backend.c b/clang/test/Driver/thinlto_backend.c
index 26d6c6714029dc..7a3d6ede7c0da7 100644
--- a/clang/test/Driver/thinlto_backend.c
+++ b/clang/test/Driver/thinlto_backend.c
@@ -1,5 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
-
 // RUN: %clang -O2 %s -flto=thin -c -o %t.o
 // RUN: llvm-lto -thinlto -o %t %t.o
 

diff  --git a/clang/test/Integration/thinlto_profile_sample_accurate.c b/clang/test/Integration/thinlto_profile_sample_accurate.c
index 8821ca76336f2b..b8ddde89d9dc68 100644
--- a/clang/test/Integration/thinlto_profile_sample_accurate.c
+++ b/clang/test/Integration/thinlto_profile_sample_accurate.c
@@ -1,5 +1,3 @@
-// XFAIL: target={{.*}}-aix{{.*}}
-
 // Test to ensure -emit-llvm profile-sample-accurate is honored in ThinLTO.
 // RUN: %clang -O2 %s -flto=thin -fprofile-sample-accurate -c -o %t.o
 // RUN: llvm-lto -thinlto -o %t %t.o


        


More information about the cfe-commits mailing list