[PATCH] D118066: [SimplifyCFG] Don't speculatively execute preductably-taken block

Sotiris Apostolakis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 29 14:30:30 PST 2022


apostolakis added a comment.

> But you can expect perf problems due to missing optimizations with select over phi.
>
> https://groups.google.com/g/llvm-dev/c/VcJnLMI7Deg/m/TshM3BkHCAAJ
>
> (Or maybe GVN is now smarter..)

Thanks for pointing this out. I guess it is debatable what the canonical form should be (selects or phis). 
I would assume that the current canonical form is the one that enables the most subsequent optimizations. 
I thought that this was selects (but not sure). Despite some passes that would prefer phis (such as GVNs perhaps) there are still a lot of other ones that prefer selects. So, some regressions seem currently unavoidable but overall I would hope that one is better.

It would be great for others to weigh-in of what's the current state and whether either selects or phis are more canonical (i.e., on average bigger enablers).

Besides this debate, shouldn't SimplifyCFG convert to this canonical form (whichever is better) and no try to optimize on its own? It seems hacky to force SimplifyCFG to make such decisions but maybe if neither form is significantly better then this ad-hoc decision-making helps overall.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118066



More information about the llvm-commits mailing list