[flang-commits] [flang] [flang][NFC] Expose force-no-alias option via CommandLineOpts (PR #232568)
via flang-commits
flang-commits at lists.llvm.org
Thu Oct 15 18:54:15 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Valentin Clement (バレンタイン クレメン) (clementval)
<details>
<summary>Changes</summary>
Move the force-no-alias cl::opt from a file-local static in Pipelines.cpp
to CommandLineOpts.cpp and declare it extern in CommandLineOpts.h, so
other pipelines built on top of flang can honor the same setting without
re-registering the option.
---
Full diff: https://github.com/llvm/llvm-project/pull/232568.diff
3 Files Affected:
- (modified) flang/include/flang/Optimizer/Passes/CommandLineOpts.h (+1)
- (modified) flang/lib/Optimizer/Passes/CommandLineOpts.cpp (+4)
- (modified) flang/lib/Optimizer/Passes/Pipelines.cpp (-4)
``````````diff
diff --git a/flang/include/flang/Optimizer/Passes/CommandLineOpts.h b/flang/include/flang/Optimizer/Passes/CommandLineOpts.h
index 35eab740a28ddc..cf159327643b8e 100644
--- a/flang/include/flang/Optimizer/Passes/CommandLineOpts.h
+++ b/flang/include/flang/Optimizer/Passes/CommandLineOpts.h
@@ -56,6 +56,7 @@ extern llvm::cl::opt<bool> disableFirAliasTags;
extern llvm::cl::opt<bool> disableFirLICM;
extern llvm::cl::opt<bool> disableFirMao;
extern llvm::cl::opt<bool> useOldAliasTags;
+extern llvm::cl::opt<bool> forceNoAlias;
/// Experimental option to replace the stack-arrays and memory-allocation-opt
/// passes with the unified allocation-placement pass.
diff --git a/flang/lib/Optimizer/Passes/CommandLineOpts.cpp b/flang/lib/Optimizer/Passes/CommandLineOpts.cpp
index bdaa12c13f475a..64a33ea9e57373 100644
--- a/flang/lib/Optimizer/Passes/CommandLineOpts.cpp
+++ b/flang/lib/Optimizer/Passes/CommandLineOpts.cpp
@@ -45,6 +45,10 @@ cl::opt<bool> skipExternalRttiDefinition(
"other compilation units"),
cl::Hidden);
+/// Force setting the no-alias attribute on fuction arguments when possible.
+llvm::cl::opt<bool> forceNoAlias("force-no-alias", llvm::cl::Hidden,
+ llvm::cl::init(true));
+
OptimizationLevel defaultOptLevel{OptimizationLevel::O0};
codegenoptions::DebugInfoKind noDebugInfo{codegenoptions::NoDebugInfo};
diff --git a/flang/lib/Optimizer/Passes/Pipelines.cpp b/flang/lib/Optimizer/Passes/Pipelines.cpp
index d965400e028d24..13e71a43772ebe 100644
--- a/flang/lib/Optimizer/Passes/Pipelines.cpp
+++ b/flang/lib/Optimizer/Passes/Pipelines.cpp
@@ -19,10 +19,6 @@
#include "llvm/Support/CommandLine.h"
#include <vector>
-/// Force setting the no-alias attribute on fuction arguments when possible.
-static llvm::cl::opt<bool> forceNoAlias("force-no-alias", llvm::cl::Hidden,
- llvm::cl::init(true));
-
/// Disable the use of fake use for arguments.
static llvm::cl::opt<bool> disableArgumentFakeUse("disable-argument-fake-use",
llvm::cl::Hidden,
``````````
</details>
https://github.com/llvm/llvm-project/pull/232568
More information about the flang-commits
mailing list