[PATCH] D113897: [GVNSink] Make GVNSink resistant against self referencing instructions (PR36954)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 03:56:26 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/GVNSink.cpp:393
   uint32_t nextValueNumber = 1;
+  Optional<BasicBlocksSet> ReachableBBs;
 
----------------
Is the optional here needed? Don't we expect this to always be set before it gets used?


================
Comment at: llvm/lib/Transforms/Scalar/GVNSink.cpp:582
     ReversePostOrderTraversal<Function*> RPOT(&F);
+    VN.setReachableBBs(collectBlocksReachableFromEntry(F));
+
----------------
Can't you just reuse RPOT here? That is, iterate it into a set? RPOT doesn't visit unreachable blocks, and it is cached, so reusing it is fine.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113897



More information about the llvm-commits mailing list