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

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 6 08:26:39 PST 2021


chill 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);
----------------
efriedma wrote:
> 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.
Ack.


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

https://reviews.llvm.org/D110817



More information about the llvm-commits mailing list