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

Carl Ritson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 10 02:51:18 PDT 2021


critson marked 2 inline comments as done.
critson added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:2727
+    // Signal repeat, simplifying any other constants.
+    return Optional<bool>();
   }
----------------
lebedev.ri wrote:
> Presumably this should return `None`?
Yes, thanks!
I had forgotten what the NoneType was called.


================
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;
----------------
lebedev.ri wrote:
> This might be more readable, we don't really care how much recursion we have..
Agreed.


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