On Mon, Apr 11, 2005 at 08:14:12PM -0700, Roland Dreier wrote: > Grant> doorbell[] is a local variable and mthca_write64() is > Grant> static inline. I don't see a problem with the assignments > Grant> to doorbell getting optimized out since the scope of that > Grant> variable is completely visible to gcc. A smart compiler > Grant> would just use registers and reduce the 32-bit stores. > > Actually, what is that the compiler sees that we write to doorbell[] > as a uint32_t but then read from it by dereferencing a uint64_t*. -O2 > turns on -fstrict-aliasing, which allows the compiler to assume that > pointers of different types never alias each other. So gcc says, hey, > all you do is write to that local doorbell[] variable and never do > anything with the values you write, so I'll just throw away that dead > code. So gcc ends up only generating code for the store in > mthca_write64() without any code to initialize doorbell[].
Yup - I saw your followup right after I posted. But this is a better explanation...thanks! grant _______________________________________________ openib-general mailing list [email protected] http://openib.org/mailman/listinfo/openib-general To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
