[PATCH] D84181: [NFC][GVN] Rewrite IsValueFullyAvailableInBlock()

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 23:27:01 PDT 2020


mkazantsev added a comment.

Though I don't see obvious problems in the new algorithm, I cannot wrap my mind around the old one and can't say if they are doing the same thing. I'd suggest the following reliable way to make sure it is NFC:

- Instead of changing logic of `IsValueFullyAvailableInBlock`, introduce a new version of it and use it.
- In debug mode, also call the old one and assert that the results are the same.
- Then, after it has been in for a long enough while and we are certain those algorithms do the same thing, remove the old one.

WDYT?



================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:686
 static bool IsValueFullyAvailableInBlock(
-    BasicBlock *BB,
-    DenseMap<BasicBlock *, AvaliabilityState> &FullyAvailableBlocks,
-    uint32_t RecurseDepth) {
-  if (RecurseDepth > MaxRecurseDepth)
-    return false;
+    BasicBlock *RootBB,
+    DenseMap<BasicBlock *, AvaliabilityState> &FixpointBlocks) {
----------------
This name only makes sense because it is used as DFS traversal root. In function signature, `BB` is more clear.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84181





More information about the llvm-commits mailing list