[clang] [flang] [llvm] Introduce -fexperimental-loop-fuse to clang and flang (PR #142686)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 7 05:23:34 PDT 2025


================
@@ -204,6 +205,10 @@ static cl::opt<bool>
     EnableLoopInterchange("enable-loopinterchange", cl::init(false), cl::Hidden,
                           cl::desc("Enable the LoopInterchange Pass"));
 
+static cl::opt<bool> EnableLoopFusion("enable-loopfusion", cl::init(false),
----------------
kasuga-fj wrote:

> I see the precedence in the code. In `flang/include/flang/Frontend/CodegenOptions.def` I see options for loop-versioning, unrolling etc. I see clang and flang differ here. clang doesn't seem to have such options except for `floop-interchange`.

I didn't really understand what you meant... There is a clang option `-funroll-loops`.

> I can remove the change from `PassBuilderPipelines.cpp` i.e. EnableFusion, as it can be redundant.

I didn't mean it is redundant. It might be useful if we want to turn on/off the loop-fusion via opt command. What I meant is, if you also want to add both clang/flang and opt options, then you should move EnableFusion into proper place (maybe it is `tools/opt/NewPMDriver.cpp`). 

At the moment, I don’t have any strong objections to adding experimental flags to clang, although I'm not sure if there's an existing policy on clang side for such cases.

https://github.com/llvm/llvm-project/pull/142686


More information about the llvm-commits mailing list