[openib-general] Re: uverbs events
Roland Dreier
roland at topspin.com
Mon Apr 11 20:14:12 PDT 2005
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[].
- R.
More information about the general
mailing list