[PATCH] D89978: Fix SROA with a PHI mergig values from a same block

Stanislav Mekhanoshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 12:00:01 PDT 2020


rampitec added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SROA.cpp:3550
+      Value *NewVal = nullptr;
+      int Idx = NewPN->getBasicBlockIndex(B);
+      if (Idx >= 0) {
----------------
efriedma wrote:
> getBasicBlockIndex is linear in the number of operands, so this is overall O(N^2) in the number of PHI operands.  Unlikely to matter in most cases, but maybe we should bail out if there are too many operands.
I think we can if we ever see such a PHI. Then alloca will remain, so overall it may be slower to work on a non-optimized code.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89978



More information about the llvm-commits mailing list