Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
[RISCV][Clang] Remove -save-restore from default features. (#76390)
Browse files Browse the repository at this point in the history
It's unnecessary to defaultly pass feature `-save-restore`, since risc-v
backend defaultly disables save-restore functionality.
  • Loading branch information
yetingk authored Dec 27, 2023
1 parent 256bf56 commit ce0c149
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
7 changes: 0 additions & 7 deletions clang/lib/Driver/ToolChains/Arch/RISCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,6 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const llvm::Triple &Triple,
Features.push_back("-relax");
}

// GCC Compatibility: -mno-save-restore is default, unless -msave-restore is
// specified.
if (Args.hasFlag(options::OPT_msave_restore, options::OPT_mno_save_restore, false))
Features.push_back("+save-restore");
else
Features.push_back("-save-restore");

// -mno-unaligned-access is default, unless -munaligned-access is specified.
AddTargetFeature(Args, Features, options::OPT_munaligned_access,
options::OPT_mno_unaligned_access, "fast-unaligned-access");
Expand Down
2 changes: 0 additions & 2 deletions clang/test/Driver/riscv-default-features.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// RUN: %clang --target=riscv64-unknown-elf -S -emit-llvm %s -o - | FileCheck %s -check-prefix=RV64

// RV32: "target-features"="+32bit,+a,+c,+m,+relax,
// RV32-SAME: -save-restore
// RV64: "target-features"="+64bit,+a,+c,+m,+relax,
// RV64-SAME: -save-restore

// Dummy function
int foo(void){
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/riscv-features.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

// SAVE-RESTORE: "-target-feature" "+save-restore"
// NO-SAVE-RESTORE: "-target-feature" "-save-restore"
// DEFAULT: "-target-feature" "-save-restore"
// DEFAULT-NOT: "-target-feature" "-save-restore"
// DEFAULT-NOT: "-target-feature" "+save-restore"

// RUN: %clang --target=riscv32-unknown-elf -### %s -munaligned-access 2>&1 | FileCheck %s -check-prefix=FAST-UNALIGNED-ACCESS
Expand Down

0 comments on commit ce0c149

Please sign in to comment.