[Chapel Merge] Fix copy propagation errors with virtual method ca

Branch: refs/heads/main
Revision: 6e3678b
Author: daviditen
Log Message:

Merge pull request #18568 from daviditen/copy-propagation-error

Fix copy propagation errors with virtual method calls

[reviewed by @e-kayrakli]

Fix two places where copy propagation was mishandling virtual method calls
leading to propagating copies where it shouldn't have. Treat virtual method
calls in the same way as regular function calls when finding kills and when
looking for uses.

Add the test case from #16935.

Fixes #16935.

Modified Files:
A test/optimizations/copyPropagation/cp-problem2.chpl

A test/optimizations/copyPropagation/cp-problem2.good
M compiler/optimizations/copyPropagation.cpp

Compare: https://github.com/chapel-lang/chapel/compare/961d3a0770e1...6e3678b63c78