A classic example of a common class of functions that can't be optimized
over even though you'd think it could be is *printf(). Standard printf()
without %n can be freely optimized over, but alas glibc has an extension
(user-defined format masks) that means printf() can call arbitrary
functions for you.
That nobody ever uses this extension is irrelevant: the compiler must
assume that you might be.