[PATCH] D110817: [GVN] Simple GVN hoist - scalars

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 11 12:26:07 PST 2021


efriedma added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:3205
+    // them by value number with the instructions from the other block.
+    if (Then->size() > Else->size())
+      std::swap(Then, Else);
----------------
BasicBlock::size() is almost never something you want to call.  Issues:

1. It's O(n) in the number of instructions in the block.
2. It's sensitive to debug intrinsic calls, so using it to drive a heuristic is inherently broken.


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

https://reviews.llvm.org/D110817



More information about the llvm-commits mailing list