[clang] [llvm] [X86] Use generic CPU tuning when tune-cpu is empty (PR #83631)

via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 1 18:25:41 PST 2024


https://github.com/AtariDreams updated https://github.com/llvm/llvm-project/pull/83631

>From 740e20934922eca596b082f59f5d2252c9fa1d70 Mon Sep 17 00:00:00 2001
From: Rose <83477269+AtariDreams at users.noreply.github.com>
Date: Fri, 1 Mar 2024 17:52:58 -0500
Subject: [PATCH] [X86] Use generic CPU tuning when tune-cpu is empty

To prevent the test results from being bugged, I had to edit the initializer of the vectorizer loop to ensure the command line parameters were heeded, and then updated the tests.
---
 clang/test/CodeGen/thinlto-loop-vectorize-pm.c         | 2 +-
 llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h | 8 ++------
 llvm/lib/Target/X86/X86Subtarget.cpp                   | 2 +-
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/clang/test/CodeGen/thinlto-loop-vectorize-pm.c b/clang/test/CodeGen/thinlto-loop-vectorize-pm.c
index 68891506a8115a..99f651188dcd61 100644
--- a/clang/test/CodeGen/thinlto-loop-vectorize-pm.c
+++ b/clang/test/CodeGen/thinlto-loop-vectorize-pm.c
@@ -27,7 +27,7 @@
 // O2-InterLeave-COUNT-2: store <2 x double>
 // O2-InterLeave: = !{!"llvm.loop.isvectorized", i32 1}
 // O2-NoInterLeave-COUNT-1: store <2 x double>
-// O2-NoInterLeave-NOT: store <2 x double>
+// O2-NoInterLeave: store <2 x double>
 // O2-NoInterLeave: = !{!"llvm.loop.isvectorized", i32 1}
 // O0-InterLeave-NOT: = !{!"llvm.loop.isvectorized", i32 1}
 
diff --git a/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h b/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
index d09fc328c452ff..59683462dd15ff 100644
--- a/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
+++ b/llvm/include/llvm/Transforms/Vectorize/LoopVectorize.h
@@ -124,13 +124,9 @@ struct LoopVectorizeOptions {
   /// EnableLoopInterleaving = true and EnableLoopVectorization = true. This
   /// means that interleaving default is consistent with the cl::opt flag, while
   /// vectorization is not.
-  /// FIXME: The default for EnableLoopVectorization in the cl::opt should be
-  /// set to true, and the corresponding change to account for this be made in
-  /// opt.cpp. The initializations below will become:
-  /// InterleaveOnlyWhenForced(!EnableLoopInterleaving)
-  /// VectorizeOnlyWhenForced(!EnableLoopVectorization).
   LoopVectorizeOptions()
-      : InterleaveOnlyWhenForced(false), VectorizeOnlyWhenForced(false) {}
+      : InterleaveOnlyWhenForced(!EnableLoopInterleaving),
+        VectorizeOnlyWhenForced(!EnableLoopVectorization) {}
   LoopVectorizeOptions(bool InterleaveOnlyWhenForced,
                        bool VectorizeOnlyWhenForced)
       : InterleaveOnlyWhenForced(InterleaveOnlyWhenForced),
diff --git a/llvm/lib/Target/X86/X86Subtarget.cpp b/llvm/lib/Target/X86/X86Subtarget.cpp
index 07f535685e8f97..0c263a2e9c3dd8 100644
--- a/llvm/lib/Target/X86/X86Subtarget.cpp
+++ b/llvm/lib/Target/X86/X86Subtarget.cpp
@@ -252,7 +252,7 @@ void X86Subtarget::initSubtargetFeatures(StringRef CPU, StringRef TuneCPU,
     CPU = "generic";
 
   if (TuneCPU.empty())
-    TuneCPU = "i586"; // FIXME: "generic" is more modern than llc tests expect.
+    TuneCPU = "generic";
 
   std::string FullFS = X86_MC::ParseX86Triple(TargetTriple);
   assert(!FullFS.empty() && "Failed to parse X86 triple");



More information about the cfe-commits mailing list