[PATCH] D138238: [SROA] Change how we speculate `load`s of `select`s -- split block, insert then/else blocks, form two-entry PHI node

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 14:19:42 PST 2022


lebedev.ri added inline comments.


================
Comment at: llvm/include/llvm/Transforms/Scalar/SROA.h:106-109
-  /// All of these select instructions have been checked for the safety of
-  /// speculation and by being speculated will allow promoting allocas
-  /// currently in the promotable queue.
-  SetVector<SelectInst *, SmallVector<SelectInst *, 2>> SpeculatableSelects;
----------------
lebedev.ri wrote:
> arsenm wrote:
> > Are there any cases where this should still try to speculate?
> I'm not sure i understand the question.
> As it can be seen from the rest of the diff here,
> for select's, we will always form diamond control flow and two-entry phi node,
> and never check if we can speculate load.
> For PHI's, we still speculate.
One improvement over this we can do, is to cache
all of the pointers derived from the current alloca,
and speculate the loads that belong to that set.
That //might// be cheap to do. Is that what you had in mind?

We also should probably report CFG as preserved unless we actually changed it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138238



More information about the llvm-commits mailing list