[clang] [llvm] [X86] Reduce -ffixed-r compile-time overhead (PR #184606)

Alexis Engelke via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 4 07:12:43 PST 2026


================
@@ -151,16 +151,7 @@ void x86::getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple,
   }
 
   const llvm::Triple::ArchType ArchType = Triple.getArch();
-  bool HasEGPR = false;
-
-  // -ffixed-r16 through -ffixed-r31 are only valid when the selected x86_64
-  // CPU enables APX EGPR by default; later -target-feature arguments still get
-  // their own validation when translated to backend features.
-  if (ArchType == llvm::Triple::x86_64) {
-    SmallVector<StringRef, 16> CPUFeatures;
-    llvm::X86::getFeaturesForCPU(getX86TargetCPU(D, Args, Triple), CPUFeatures);
-    HasEGPR = llvm::is_contained(CPUFeatures, "+egpr");
-  }
+  std::optional<bool> HasEGPR;
----------------
aengelke wrote:

std::optional<bool> only invites for mistakes (e.g. `if (HasEGPR)` returns true even if the stored value is false).

https://github.com/llvm/llvm-project/pull/184606


More information about the cfe-commits mailing list