summaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm18/patches/fix-build.patch
blob: 2552b10b27e20880f6187d80c33eaee1efb38dda (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--- a/include/llvm/Analysis/RegionInfoImpl.h
+++ b/include/llvm/Analysis/RegionInfoImpl.h
@@ -852,10 +852,14 @@ RegionInfoBase<Tr>::getMaxRegionExit(BlockT *BB) const {
     // Get the single exit of BB.
     if (R && R->getEntry() == BB)
       Exit = R->getExit();
-    else if (++BlockTraits::child_begin(BB) == BlockTraits::child_end(BB))
-      Exit = *BlockTraits::child_begin(BB);
-    else // No single exit exists.
-      return Exit;
+    else {
+      auto next = BlockTraits::child_begin(BB);
+      ++next;
+      if (next == BlockTraits::child_end(BB))
+        Exit = *BlockTraits::child_begin(BB);
+      else // No single exit exists.
+        return Exit;
+    }
 
     // Get largest region that starts at Exit.
     RegionT *ExitR = getRegionFor(Exit);