Skip to content

Commit 985c008

Browse files
authored
[RISCV][NFC] Use AddTargetFeature to add fast-unaligned-access (#74280)
We can reduce some code.
1 parent 1f71db7 commit 985c008

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

clang/lib/Driver/ToolChains/Arch/RISCV.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,8 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const llvm::Triple &Triple,
171171
Features.push_back("-save-restore");
172172

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

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

0 commit comments

Comments
 (0)