On Thu May 18 20:36:57 2023 +0000, Giovanni Mascellani wrote:
No, I don't think the caller gets to decide anything. The optimizing pass can either decide to alter the instruction stream (if it thinks there is some optimization to be done) or leave it unchanged. In the first case it returns `true`, in the second `false`. The caller will receive whatever stream the pass decides to leave. In this case, however, I don't think there is any question about whether to touch or not the instruction stream. We definitely want to fold the absolute value operation, since it's pretty clear that for the native compiler `abs(INT_MIN) == INT_MIN`. The only care we have to use is to never call `abs(INT_MIN)` in C, because that's UB. If you use the statement I provided above that should never happen and everything is fine.
Ahh, okay that makes sense - I'll go ahead and make this change now; knowing the native compiler's result cleared this up right away!