Skip to content

Commit 0dc613d

Browse files
committed
[flang] Add -f[no-]vectorize flags
1 parent b74176a commit 0dc613d

File tree

13 files changed

+175
-176
lines changed

13 files changed

+175
-176
lines changed

clang/include/clang/Driver/Driver.h

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ class JobAction;
5555
class ToolChain;
5656

5757
/// Describes the kind of LTO mode selected via -f(no-)?lto(=.*)? options.
58-
enum LTOKind {
59-
LTOK_None,
60-
LTOK_Full,
61-
LTOK_Thin,
62-
LTOK_Unknown
63-
};
58+
enum LTOKind { LTOK_None, LTOK_Full, LTOK_Thin, LTOK_Unknown };
6459

6560
/// Whether headers used to construct C++20 module units should be looked
6661
/// up by the path supplied on the command line, or in the user or system
@@ -110,17 +105,9 @@ class Driver {
110105
DXCMode
111106
} Mode;
112107

113-
enum SaveTempsMode {
114-
SaveTempsNone,
115-
SaveTempsCwd,
116-
SaveTempsObj
117-
} SaveTemps;
108+
enum SaveTempsMode { SaveTempsNone, SaveTempsCwd, SaveTempsObj } SaveTemps;
118109

119-
enum BitcodeEmbedMode {
120-
EmbedNone,
121-
EmbedMarker,
122-
EmbedBitcode
123-
} BitcodeEmbed;
110+
enum BitcodeEmbedMode { EmbedNone, EmbedMarker, EmbedBitcode } BitcodeEmbed;
124111

125112
enum OffloadMode {
126113
OffloadHostDevice,
@@ -166,9 +153,7 @@ class Driver {
166153
};
167154

168155
// Diag - Forwarding function for diagnostics.
169-
DiagnosticBuilder Diag(unsigned DiagID) const {
170-
return Diags.Report(DiagID);
171-
}
156+
DiagnosticBuilder Diag(unsigned DiagID) const { return Diags.Report(DiagID); }
172157

173158
// FIXME: Privatize once interface is stable.
174159
public:
@@ -404,7 +389,6 @@ class Driver {
404389
SmallString<128> &CrashDiagDir);
405390

406391
public:
407-
408392
/// Takes the path to a binary that's either in bin/ or lib/ and returns
409393
/// the path to clang's resource directory.
410394
static std::string GetResourcesPath(StringRef BinaryPath);
@@ -419,9 +403,7 @@ class Driver {
419403
/// Name to use when invoking gcc/g++.
420404
const std::string &getCCCGenericGCCName() const { return CCCGenericGCCName; }
421405

422-
llvm::ArrayRef<std::string> getConfigFiles() const {
423-
return ConfigFiles;
424-
}
406+
llvm::ArrayRef<std::string> getConfigFiles() const { return ConfigFiles; }
425407

426408
const llvm::opt::OptTable &getOpts() const { return getDriverOptTable(); }
427409

@@ -447,9 +429,7 @@ class Driver {
447429
std::string getTargetTriple() const { return TargetTriple; }
448430

449431
/// Get the path to the main clang executable.
450-
const char *getClangProgramPath() const {
451-
return ClangExecutable.c_str();
452-
}
432+
const char *getClangProgramPath() const { return ClangExecutable.c_str(); }
453433

454434
bool isSaveTempsEnabled() const { return SaveTemps != SaveTempsNone; }
455435
bool isSaveTempsObj() const { return SaveTemps == SaveTempsObj; }
@@ -561,8 +541,9 @@ class Driver {
561541
/// This routine handles additional processing that must be done in addition
562542
/// to just running the subprocesses, for example reporting errors, setting
563543
/// up response files, removing temporary files, etc.
564-
int ExecuteCompilation(Compilation &C,
565-
SmallVectorImpl< std::pair<int, const Command *> > &FailingCommands);
544+
int ExecuteCompilation(
545+
Compilation &C,
546+
SmallVectorImpl<std::pair<int, const Command *>> &FailingCommands);
566547

567548
/// Contains the files in the compilation diagnostic report generated by
568549
/// generateCompilationDiagnostics.
@@ -758,7 +739,6 @@ class Driver {
758739
const CUIDOptions &getCUIDOpts() const { return CUIDOpts; }
759740

760741
private:
761-
762742
/// Tries to load options from configuration files.
763743
///
764744
/// \returns true if error occurred.

clang/include/clang/Driver/Options.td

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3981,11 +3981,15 @@ defm assumptions : BoolFOption<"assumptions",
39813981
"Disable codegen and compile-time checks for C++23's [[assume]] attribute">,
39823982
PosFlag<SetTrue>>;
39833983

3984+
3985+
let Visibility = [ClangOption, FlangOption] in {
39843986
def fvectorize : Flag<["-"], "fvectorize">, Group<f_Group>,
39853987
HelpText<"Enable the loop vectorization passes">;
39863988
def fno_vectorize : Flag<["-"], "fno-vectorize">, Group<f_Group>;
39873989
def : Flag<["-"], "ftree-vectorize">, Alias<fvectorize>;
39883990
def : Flag<["-"], "fno-tree-vectorize">, Alias<fno_vectorize>;
3991+
}
3992+
39893993
def fslp_vectorize : Flag<["-"], "fslp-vectorize">, Group<f_Group>,
39903994
HelpText<"Enable the superword-level parallelism vectorization passes">;
39913995
def fno_slp_vectorize : Flag<["-"], "fno-slp-vectorize">, Group<f_Group>;
@@ -7315,6 +7319,10 @@ def mlink_builtin_bitcode : Separate<["-"], "mlink-builtin-bitcode">,
73157319
def mlink_bitcode_file
73167320
: Separate<["-"], "mlink-bitcode-file">,
73177321
HelpText<"Link the given bitcode file before performing optimizations.">;
7322+
7323+
def vectorize_loops : Flag<["-"], "vectorize-loops">,
7324+
HelpText<"Run the Loop vectorization passes">,
7325+
MarshallingInfoFlag<CodeGenOpts<"VectorizeLoop">>;
73187326
} // let Visibility = [CC1Option, FC1Option]
73197327

73207328
let Visibility = [CC1Option] in {
@@ -7430,9 +7438,6 @@ defm link_builtin_bitcode_postopt: BoolMOption<"link-builtin-bitcode-postopt",
74307438
PosFlag<SetTrue, [], [ClangOption], "Link builtin bitcodes after the "
74317439
"optimization pipeline">,
74327440
NegFlag<SetFalse, [], [ClangOption]>>;
7433-
def vectorize_loops : Flag<["-"], "vectorize-loops">,
7434-
HelpText<"Run the Loop vectorization passes">,
7435-
MarshallingInfoFlag<CodeGenOpts<"VectorizeLoop">>;
74367441
def vectorize_slp : Flag<["-"], "vectorize-slp">,
74377442
HelpText<"Run the SLP vectorization passes">,
74387443
MarshallingInfoFlag<CodeGenOpts<"VectorizeSLP">>;

0 commit comments

Comments
 (0)