[PATCH] D107803: [SimpifyCFG] Remove recursion from FoldCondBranchOnPHI. NFCI.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 10 01:33:00 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:2727
+    // Signal repeat, simplifying any other constants.
+    return Optional<bool>();
   }
----------------
Presumably this should return `None`?


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:2735-2741
+  Optional<bool> Result;
+  unsigned Iterations = 0;
+  do {
+    Result = FoldCondBranchOnPHIImpl(BI, DTU, DL, AC);
+    Iterations++;
+  } while (!Result);
+  return *Result || Iterations > 1;
----------------
This might be more readable, we don't really care how much recursion we have..


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107803/new/

https://reviews.llvm.org/D107803



More information about the llvm-commits mailing list