Comment by jcalvinowens
3 days ago
> Take anything Linus says about compilers with a grain of salt
I think he's making an argument about CPU behavior here more than about compilers: if we call loads and stores which aliasing optimizations might remove "redundant", he's saying that modern machines with big caches and store buffers make those "redundant" operations so cheap they don't matter in practice for most workloads.
Of course, it's admittedly an oversimplification to reduce aliasing optimizations to simply eliminating loads and stores, you described things which go beyond that.
However, I just ran a silly little test where I added `-fno-strict-aliasing` to CFLAGS and rebuilt the world on one of my gentoo build machines, it only got 1.5% slower at compiling an allmodconfig linux kernel (gcc-14):
Before: 14m39.101s 14m42.462s 14m41.497s 14m44.540s
After: 14m54.354s 14m54.415s 14m55.580s 14m55.793s
That's on a shiny new znver5.
Very cool benchmark, thanks!