In this note we study the right large deviation of the top eigenvalue (or singular value) of the sum or product of two random matrices A and B as their dimensions goes to infinity. The matrices A and B are each assumed to be taken from an invariant (or bi-invariant) ensemble with a confining potential with a possible wall beyond which no eigenvalues/singular values are allowed. The introduction of this wall puts different models in a very generic framework. In particular, the case where the wall is exactly at the right edge of the limiting spectral density is equivalent, from the point of view of large deviations, to considering a fixed diagonal matrices, as studied previously in Ref.[1]. We show that that the tilting method introduced in Ref. [1] can be extended to our general setting and is equivalent to the study of a spherical spin glass model specific to the operation -sum of symmetric matrices / product of symmetric matrices / sum of rectangular matrices -we are considering.