Skip to content

Conversation

@matthias-springer
Copy link
Member

@matthias-springer matthias-springer commented Jan 13, 2026

This commit simplifies the design of the RegionBranchOpInterface. The property of being a successor input is now independent of the region branch point.

There is a new API for querying successor inputs: RegionBranchOpInterface::getSuccessorInputs(RegionSuccessor). Note that this function does not take a RegionBranchPoint as parameter.

The RegionSuccessor API is now also simpler: it no longer stores successor inputs. A region successor is simply Region *, wrapped around a convenience API.

Note: This commit is mostly mechanical. Analyses / transformations that build on top of the RegionBranchOpInterface (e.g., visitNonControlFlowArguments API) can likely be simplified in follow-up commits.

Note for LLVM integration: Split RegionBranchOpInterface::getSuccessorRegion implementations into two functions: getSuccessorRegion and `getSuccessorInputs. (There are many examples in this commit.)

RFC: https://discourse.llvm.org/t/rfc-simplify-regionbranchopinterface-separate-successor-inputs-from-region-successor/89420/7

@matthias-springer matthias-springer force-pushed the users/matthias-springer/split_successor_inputs branch from 4976ae4 to 792ea47 Compare January 13, 2026 19:18
Base automatically changed from users/matthias-springer/region_successor to main January 14, 2026 09:57
@matthias-springer matthias-springer force-pushed the users/matthias-springer/split_successor_inputs branch from 792ea47 to 6feec83 Compare January 14, 2026 09:58
@github-actions
Copy link

github-actions bot commented Jan 14, 2026

🐧 Linux x64 Test Results

  • 121197 tests passed
  • 4756 tests skipped

✅ The build succeeded and all tests passed.

@matthias-springer matthias-springer force-pushed the users/matthias-springer/split_successor_inputs branch 3 times, most recently from 6b144e4 to 072b98c Compare January 14, 2026 11:12
@matthias-springer matthias-springer marked this pull request as ready for review January 14, 2026 11:13
@llvmbot llvmbot added the ClangIR Anything related to the ClangIR project label Jan 14, 2026
@matthias-springer matthias-springer force-pushed the users/matthias-springer/split_successor_inputs branch from f09ea5a to cc13c77 Compare January 14, 2026 11:28
@matthias-springer matthias-springer requested review from rengolin and removed request for yinying-lisa-li January 14, 2026 11:36
Copy link
Member

@zero9178 zero9178 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please give it a few days for others to review as well

branch->getResults().slice(firstIndex, inputs.size())),
lattices, firstIndex);
branch, RegionSuccessor::parent(),
branch->getResults().slice(firstIndex, inputs.size()), lattices,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we avoid adding an extra argument to visitNonControlFlowArgumentsImpl?"Since this PR implements getSuccessorInputs, I think we could potentially leverage it in the subsequent call.

Copy link
Member Author

@matthias-springer matthias-springer Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. I am trying to do that here: #175978. But I don't know that part of the code base well enough. I'm not sure if that's safe.

This PR is already large enough, so I wanted to limit the changes to the "mechanical" ones, for which we can for sure say that they are correct. Then improve that API (and maybe others) in a follow-up commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks. I've approved it.😉

Copy link
Member

@linuxlonelyeagle linuxlonelyeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@matthias-springer matthias-springer force-pushed the users/matthias-springer/split_successor_inputs branch from bf8c119 to 3b1d7ed Compare January 16, 2026 07:55
@matthias-springer matthias-springer merged commit f764337 into main Jan 16, 2026
12 checks passed
@matthias-springer matthias-springer deleted the users/matthias-springer/split_successor_inputs branch January 16, 2026 09:16
@llvm-ci
Copy link

llvm-ci commented Jan 16, 2026

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building clang,flang,mlir at step 5 "compile-openmp".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/37130

Here is the relevant piece of the build log for the reference
Step 5 (compile-openmp) failure: build (failure)
...
           ~~~~~~~^~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Target/Wasm/TranslateFromWasm.cpp: In instantiation of ‘constexpr bool {anonymous}::isValueOneOf(std::byte, {anonymous}::ByteSequence<allowedFlags ...>) [with std::byte ...allowedFlags = {(std::byte)11, (std::byte)5}]’:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Target/Wasm/TranslateFromWasm.cpp:965:21:   required from ‘llvm::FailureOr<{anonymous}::ExpressionParser::ParseResultWithInfo> {anonymous}::ExpressionParser::parse(mlir::OpBuilder&, {anonymous}::ByteSequence<allowedFlags ...>) [with std::byte ...ExpressionParseEnd = {(std::byte)11, (std::byte)5}]’
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Target/Wasm/TranslateFromWasm.cpp:403:10:   required from ‘llvm::FailureOr<std::byte> {anonymous}::ExpressionParser::parseBlockContent(mlir::OpBuilder&, mlir::Block*, mlir::TypeRange, mlir::Location, mlir::wasmssa::LabelLevelOpInterface, FilterT) [with FilterT = {anonymous}::ByteSequence<(std::byte)11, (std::byte)5>]’
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Target/Wasm/TranslateFromWasm.cpp:1057:57:   required from here
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Target/Wasm/TranslateFromWasm.cpp:108:18: warning: suggest parentheses around comparison in operand of ‘|’ [-Wparentheses]
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Target/Wasm/TranslateFromWasm.cpp:108:18: warning: suggest parentheses around comparison in operand of ‘|’ [-Wparentheses]
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-copy’
18.172 [3824/32/3859] Building CXX object tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o
FAILED: tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o 
ccache /usr/bin/c++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/mlir/lib/Dialect/SCF/IR -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR -Itools/mlir/include -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/include -Iinclude -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-array-bounds -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Wno-unused-but-set-parameter -Wno-deprecated-copy -O3 -DNDEBUG -UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -std=c++1z -MD -MT tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o -MF tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o.d -o tools/mlir/lib/Dialect/SCF/IR/CMakeFiles/obj.MLIRSCFDialect.dir/SCF.cpp.o -c /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR/SCF.cpp
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR/SCF.cpp: In member function ‘mlir::ValueRange mlir::scf::ExecuteRegionOp::getSuccessorInputs(mlir::RegionSuccessor)’:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR/SCF.cpp:314:31: error: operands to ?: have different types ‘mlir::Operation::result_range {aka mlir::ResultRange}’ and ‘mlir::ValueRange’
   return successor.isParent() ? getOperation()->getResults() : ValueRange();
          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR/SCF.cpp:314:31: note:   and each type can be converted to the other
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR/SCF.cpp: In member function ‘mlir::ValueRange mlir::scf::IfOp::getSuccessorInputs(mlir::RegionSuccessor)’:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR/SCF.cpp:2140:31: error: operands to ?: have different types ‘mlir::Operation::result_range {aka mlir::ResultRange}’ and ‘mlir::ValueRange’
   return successor.isParent() ? getOperation()->getResults() : ValueRange();
          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR/SCF.cpp:2140:31: note:   and each type can be converted to the other
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR/SCF.cpp: In member function ‘mlir::ValueRange mlir::scf::IndexSwitchOp::getSuccessorInputs(mlir::RegionSuccessor)’:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR/SCF.cpp:3878:31: error: operands to ?: have different types ‘mlir::Operation::result_range {aka mlir::ResultRange}’ and ‘mlir::ValueRange’
   return successor.isParent() ? getOperation()->getResults() : ValueRange();
          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/mlir/lib/Dialect/SCF/IR/SCF.cpp:3878:31: note:   and each type can be converted to the other
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-deprecated-copy’
18.173 [3824/31/3860] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/LTO.cpp.o
In file included from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/LTO/LTO.h:25:0,
                 from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/lib/LTO/LTO.cpp:13:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/IR/ModuleSummaryIndex.h: In member function ‘llvm::TypeIdSummary& llvm::ModuleSummaryIndex::getOrInsertTypeIdSummary(llvm::StringRef)’:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/IR/ModuleSummaryIndex.h:1930:33: warning: unused variable ‘GUID’ [-Wunused-variable]
     for (auto &[GUID, TypeIdPair] : make_range(TidIter))
                                 ^
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/IR/ModuleSummaryIndex.h: In member function ‘const llvm::TypeIdSummary* llvm::ModuleSummaryIndex::getTypeIdSummary(llvm::StringRef) const’:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/IR/ModuleSummaryIndex.h:1944:39: warning: unused variable ‘GUID’ [-Wunused-variable]
     for (const auto &[GUID, TypeIdPair] : make_range(TidIter))
                                       ^
In file included from /usr/include/c++/7/cassert:44:0,
                 from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/ProfileData/InstrProf.h:40,
                 from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Analysis/IndirectCallPromotionAnalysis.h:16,
                 from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Transforms/IPO/MemProfContextDisambiguation.h:18,
                 from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/lib/LTO/LTO.cpp:60:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/ProfileData/InstrProf.h: In member function ‘llvm::ArrayRef<llvm::InstrProfValueSiteRecord> llvm::InstrProfRecord::getValueSitesForKind(uint32_t) const’:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/ProfileData/InstrProf.h:1027:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~

matthias-springer added a commit that referenced this pull request Jan 16, 2026
matthias-springer added a commit that referenced this pull request Jan 16, 2026
Fix this build error, which is reported by some compilers after #175815:

```
error: operands to ?: have different types ‘mlir::Operation::result_range {aka mlir::ResultRange}’ and ‘mlir::ValueRange’
   return successor.isParent() ? getOperation()->getResults() : ValueRange();
```
kkwli pushed a commit to kkwli/llvm-project that referenced this pull request Jan 16, 2026
…#175815)

This commit simplifies the design of the `RegionBranchOpInterface`. The
property of being a successor input is now independent of the region
branch point.

There is a new API for querying successor inputs:
`RegionBranchOpInterface::getSuccessorInputs(RegionSuccessor)`. Note
that this function does **not** take a `RegionBranchPoint` as parameter.

The `RegionSuccessor` API is now also simpler: it no longer stores
successor inputs. A region successor is simply `Region *`, wrapped
around a convenience API.

Note: This commit is mostly mechanical. Analyses / transformations that
build on top of the `RegionBranchOpInterface` (e.g.,
`visitNonControlFlowArguments` API) can likely be simplified in
follow-up commits.

Note for LLVM integration: Split
`RegionBranchOpInterface::getSuccessorRegion` implementations into two
functions: `getSuccessorRegion` and `getSuccessorInputs. (There are many
examples in this commit.)

RFC:
https://discourse.llvm.org/t/rfc-simplify-regionbranchopinterface-separate-successor-inputs-from-region-successor/89420/7
kkwli pushed a commit to kkwli/llvm-project that referenced this pull request Jan 16, 2026
Fix this build error, which is reported by some compilers after llvm#175815:

```
error: operands to ?: have different types ‘mlir::Operation::result_range {aka mlir::ResultRange}’ and ‘mlir::ValueRange’
   return successor.isParent() ? getOperation()->getResults() : ValueRange();
```
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Jan 18, 2026
…#175815)

This commit simplifies the design of the `RegionBranchOpInterface`. The
property of being a successor input is now independent of the region
branch point.

There is a new API for querying successor inputs:
`RegionBranchOpInterface::getSuccessorInputs(RegionSuccessor)`. Note
that this function does **not** take a `RegionBranchPoint` as parameter.

The `RegionSuccessor` API is now also simpler: it no longer stores
successor inputs. A region successor is simply `Region *`, wrapped
around a convenience API.

Note: This commit is mostly mechanical. Analyses / transformations that
build on top of the `RegionBranchOpInterface` (e.g.,
`visitNonControlFlowArguments` API) can likely be simplified in
follow-up commits.

Note for LLVM integration: Split
`RegionBranchOpInterface::getSuccessorRegion` implementations into two
functions: `getSuccessorRegion` and `getSuccessorInputs. (There are many
examples in this commit.)

RFC:
https://discourse.llvm.org/t/rfc-simplify-regionbranchopinterface-separate-successor-inputs-from-region-successor/89420/7
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Jan 18, 2026
Fix this build error, which is reported by some compilers after llvm#175815:

```
error: operands to ?: have different types ‘mlir::Operation::result_range {aka mlir::ResultRange}’ and ‘mlir::ValueRange’
   return successor.isParent() ? getOperation()->getResults() : ValueRange();
```
praveen-g-ctt pushed a commit to llvm/torch-mlir that referenced this pull request Jan 21, 2026
Integrate llvm at 3ca2a5fc0b84762f0e7d8a0e613fd69f7e344219

This includes the **RegionBranchOpInterface** related changes from
llvm/llvm-project#175815
amd-eochoalo added a commit to iree-org/iree that referenced this pull request Jan 22, 2026
This reverts commit 8ca6c8f13398c5bbe961e9bc874d6b3de398e5e8.

Also uses `visitNonControlFlowArguments` new API since
llvm/llvm-project#175815
BStott6 pushed a commit to BStott6/llvm-project that referenced this pull request Jan 22, 2026
…#175815)

This commit simplifies the design of the `RegionBranchOpInterface`. The
property of being a successor input is now independent of the region
branch point.

There is a new API for querying successor inputs:
`RegionBranchOpInterface::getSuccessorInputs(RegionSuccessor)`. Note
that this function does **not** take a `RegionBranchPoint` as parameter.

The `RegionSuccessor` API is now also simpler: it no longer stores
successor inputs. A region successor is simply `Region *`, wrapped
around a convenience API.

Note: This commit is mostly mechanical. Analyses / transformations that
build on top of the `RegionBranchOpInterface` (e.g.,
`visitNonControlFlowArguments` API) can likely be simplified in
follow-up commits.

Note for LLVM integration: Split
`RegionBranchOpInterface::getSuccessorRegion` implementations into two
functions: `getSuccessorRegion` and `getSuccessorInputs. (There are many
examples in this commit.)

RFC:
https://discourse.llvm.org/t/rfc-simplify-regionbranchopinterface-separate-successor-inputs-from-region-successor/89420/7
BStott6 pushed a commit to BStott6/llvm-project that referenced this pull request Jan 22, 2026
Fix this build error, which is reported by some compilers after llvm#175815:

```
error: operands to ?: have different types ‘mlir::Operation::result_range {aka mlir::ResultRange}’ and ‘mlir::ValueRange’
   return successor.isParent() ? getOperation()->getResults() : ValueRange();
```
keshavvinayak01 pushed a commit to iree-org/iree that referenced this pull request Jan 27, 2026
This reverts commit 8ca6c8f13398c5bbe961e9bc874d6b3de398e5e8.

Also uses `visitNonControlFlowArguments` new API since
llvm/llvm-project#175815

Signed-off-by: Keshav Vinayak Jha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ClangIR Anything related to the ClangIR project flang:fir-hlfir flang Flang issues not falling into any other category mlir:affine mlir:async mlir:bufferization Bufferization infrastructure mlir:emitc mlir:gpu mlir:memref mlir:openacc mlir:scf mlir:shape mlir:sparse Sparse compiler in MLIR mlir openacc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants