[PATCH] D89978: Fix SROA with a constant value PHI

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 22 16:39:06 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SROA.cpp:3527
     PHINode *PHI = cast<PHINode>(GEPI.getPointerOperand());
-    if (GEPI.getParent() != PHI->getParent() ||
+    if (GEPI.getParent() != PHI->getParent() || PHI->hasConstantValue() ||
         llvm::any_of(PHI->incoming_values(), [](Value *In)
----------------
I don't think that's what you want to check.  In particular, it doesn't handle the case where a block has multiple predecessors containing a construct like `br i1 undef, label %cond.end.i, label %cond.end.i` (or more commonly, a switch).


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

https://reviews.llvm.org/D89978



More information about the llvm-commits mailing list