Currently, AMDGPU functions have `target-features` attribute populated with all default features for the target GPU. This is redundant because the backend can derive these defaults from the `target-cpu` attribute via `AMDGPUTargetMachine::getFeatureString()`. In this PR, for AMDGPU targets only: - Functions without explicit target attributes no longer emit `target-features` - Functions with `__attribute__((target(...)))` or `-target-feature` emit only features that differ from the target's defaults (delta) The backend already handles missing `target-features` correctly by falling back to the TargetMachine's defaults. A new cc1 flag `-famdgpu-emit-full-target-features` is added to emit full features when needed. Example: Before: ```llvm attributes #0 = { "target-cpu"="gfx90a" "target-features"="+16-bit-insts,+atomic-buffer-global-pk-add-f16-insts,+atomic-fadd-rtn-insts,+ci-insts,+dl-insts,+dot1-insts,+dot2-insts,..." } ``` After (default): ```llvm attributes #0 = { "target-cpu"="gfx90a" } ``` After (with explicit `+wavefrontsize32` override): ```llvm attributes #0 = { "target-cpu"="gfx90a" "target-features"="+wavefrontsize32" } ```
3.4 KiB
3.4 KiB