[clang] [RFC][Clang][AMDGPU] Emit only delta target-features to reduce IR bloat (PR #176533)

Matt Arsenault via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 20 05:38:08 PST 2026


================
@@ -2950,14 +2950,22 @@ bool CodeGenModule::GetCPUAndFeaturesAttributes(GlobalDecl GD,
   const auto *SD = FD ? FD->getAttr<CPUSpecificAttr>() : nullptr;
   const auto *TC = FD ? FD->getAttr<TargetClonesAttr>() : nullptr;
   bool AddedAttr = false;
+  auto HandleFeatureDelta = [&](llvm::StringMap<bool> &FeatureMap) {
+    // Get the default feature map for the (possibly overridden) target CPU.
+    llvm::StringMap<bool> DefaultFeatureMap;
+    getTarget().initFeatureMap(DefaultFeatureMap, getContext().getDiagnostics(),
+                               TargetCPU, {});
+    for (const auto &[K, V] : FeatureMap) {
----------------
arsenm wrote:

Ideally this wouldn't require string logic, and use the bitset, but for now you probably can't do any better 

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


More information about the cfe-commits mailing list