Yes, these are functionally equivalent. However, the difference between these two is that the call to f() in 1st is in sub-expression of throw statement, while the call in 2nd is not. If the call is in the sub-expression of throw statements, we can guarantee that the call is only invoked to be thrown. I just wanted to chase this clear case.
> On Thu, Oct 8, 2015 at 9:54 AM, <junb...@codeaurora.org> wrote: > >> > I think this actually makes it less general. You would presumably >> perform >> > different inlining for: >> > >> > throw f(x, y); >> > >> > versus >> > >> > auto k = f(x, y); >> > throw k; >> >> We need to differentiate between these two. For the second case, we >> should >> not add any attribute because itâs not invoked in the EH region and it >> could have any other purposes other than exception handling. I believe >> we >> need to specifically handle only the case where we can guarantee that >> the >> call is invoked only in exception handling context. > > > Modulo copying the value returned by f, those two are equivalent, and it's > entirely reasonable to want to refactor one into the other. Such > refactoring should not affect the optimizer's behavior on this code. Why > do > you think they should be treated differently? > _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits