Add extra tests from #60280 and #60278 as well as test showing missed optimization opportunity.
mentioned in commit 366e1faa