[llvm] WIP - [DTLTO] Forward loop interchange to DTLTO remote compilations (PR #208591)
Ben Dunbobbin via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 9 17:09:07 PDT 2026
https://github.com/bd1976bris created https://github.com/llvm/llvm-project/pull/208591
Recent upstream LLVM changes enabled `LoopInterchangePass` by default through `PipelineTuningOptions`. TLTO observes that state directly from the LTO config, but DTLTO was not forwarding the equivalent Clang option to the remote compiler. As a result, TLTO could run loop interchange pass while DTLTO did not, producing codegen differences for configurations that exposed profitable/legally interchangeable loops. Note that this was a pre-existing issue, the change in default has simply exposed it.
Forward `C.PTO.LoopInterchange` as `-floop-interchange` when constructing the common DTLTO remote compiler options. Extend the Prospero DTLTO clang-options test to check that the SN-DBS remote command line includes the forwarded option.
>From 2a563583be3b02b0a8b5e965b45671323f203c52 Mon Sep 17 00:00:00 2001
From: Ben <ben.dunbobbin at sony.com>
Date: Fri, 10 Jul 2026 01:05:39 +0100
Subject: [PATCH] [DTLTO] Forward loop interchange to DTLTO remote compilations
Recent upstream LLVM changes enabled LoopInterchangePass by default through
PipelineTuningOptions. TLTO observes that state directly from the LTO config,
but DTLTO was not forwarding the equivalent Clang option to the remote
compiler. As a result, TLTO could run loop interchange pass while DTLTO did
not, producing codegen differences for configurations that exposed
profitable/legally interchangeable loops. Note that this was a pre-existing
issue, the change in default has simply exposed it.
Forward C.PTO.LoopInterchange as -floop-interchange when constructing the
common DTLTO remote compiler options. Extend the Prospero DTLTO clang-options
test to check that the SN-DBS remote command line includes the forwarded
option.
---
llvm/lib/DTLTO/DTLTO.cpp | 2 ++
llvm/test/ThinLTO/X86/dtlto/json.ll | 1 +
2 files changed, 3 insertions(+)
diff --git a/llvm/lib/DTLTO/DTLTO.cpp b/llvm/lib/DTLTO/DTLTO.cpp
index 6805746f64978..0bdbc652e8149 100644
--- a/llvm/lib/DTLTO/DTLTO.cpp
+++ b/llvm/lib/DTLTO/DTLTO.cpp
@@ -195,6 +195,8 @@ void lto::DTLTO::buildCommonRemoteCompilerOptions() {
Ops.push_back("-ffunction-sections");
if (C.Options.DataSections)
Ops.push_back("-fdata-sections");
+ if (C.PTO.LoopInterchange)
+ Ops.push_back("-floop-interchange");
if (C.RelocModel == Reloc::PIC_)
// Clang doesn't have -fpic for all triples.
diff --git a/llvm/test/ThinLTO/X86/dtlto/json.ll b/llvm/test/ThinLTO/X86/dtlto/json.ll
index ee1c428c31c7c..e705e97bd8858 100644
--- a/llvm/test/ThinLTO/X86/dtlto/json.ll
+++ b/llvm/test/ThinLTO/X86/dtlto/json.ll
@@ -37,6 +37,7 @@ LLVM-NEXT: "clang"
CHECK-NEXT: "-c"
CHECK-NEXT: "--target=x86_64-unknown-linux-gnu"
CHECK-NEXT: "-O2"
+CHECK-NEXT: "-floop-interchange"
CHECK-NEXT: "-fpic"
CHECK-NEXT: "-Wno-unused-command-line-argument"
CHECK-NEXT: "--rota1=10"
More information about the llvm-commits
mailing list