Skip to content

Commit

Permalink
[RISCV][NFC] Use AddTargetFeature to add fast-unaligned-access (#74280)
Browse files Browse the repository at this point in the history
We can reduce some code.
  • Loading branch information
wangpc-pp committed Dec 12, 2023
1 parent 1f71db7 commit 985c008
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions clang/lib/Driver/ToolChains/Arch/RISCV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,8 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const llvm::Triple &Triple,
Features.push_back("-save-restore");

// -mno-unaligned-access is default, unless -munaligned-access is specified.
if (const Arg *A = Args.getLastArg(options::OPT_munaligned_access,
options::OPT_mno_unaligned_access)) {
if (A->getOption().matches(options::OPT_munaligned_access))
Features.push_back("+fast-unaligned-access");
else
Features.push_back("-fast-unaligned-access");
}
AddTargetFeature(Args, Features, options::OPT_munaligned_access,
options::OPT_mno_unaligned_access, "fast-unaligned-access");

// Now add any that the user explicitly requested on the command line,
// which may override the defaults.
Expand Down

0 comments on commit 985c008

Please sign in to comment.