[clang] [CIR] Fix building ClangIR after RegionBranchOpInterface revamp (PR #165441)

Mehdi Amini via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 28 11:00:44 PDT 2025


================
@@ -26,14 +26,16 @@ void LoopOpInterface::getLoopOpSuccessorRegions(
   }
 
   // Branching from condition: go to body or exit.
-  if (&op.getCond() == point.getRegionOrNull()) {
-    regions.emplace_back(mlir::RegionSuccessor(op->getResults()));
+  if (&op.getCond() ==
+      point.getTerminatorPredecessorOrNull()->getParentRegion()) {
+    regions.emplace_back(mlir::RegionSuccessor(op, op->getResults()));
     regions.emplace_back(&op.getBody(), op.getBody().getArguments());
     return;
   }
 
   // Branching from body: go to step (for) or condition.
-  if (&op.getBody() == point.getRegionOrNull()) {
+  if (&op.getBody() ==
+      point.getTerminatorPredecessorOrNull()->getParentRegion()) {
----------------
joker-eph wrote:

```suggestion
  if (&op.getBody() == parentRegion) {
```

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


More information about the cfe-commits mailing list