I can't take this compiler braindamage any more, so I just decided to remove the ____ilog2_NaN checks, and return 0 for any constant value < 2.
It's commit 474c90156c8d ("give up on gcc ilog2() constant optimizations") in my tree. I'll push it out later after my usual build tests (and I have a few other pulls to do). Linus