I don't know if an optimization is allowed to "invent" a write, but I would be surprised if an optimizer goes that far because I have to believe that the number of cases where more writes improve performance are pretty slim.
Keep in mind that this is a synthetic benchmark. The task is to remove outliers and for that the roughly 99% correct guesses of the branch predictor is perfectly fine.
Generally most forms of PGO does not try to capture number of mispredicted branches (which isn't the same as how often a branch is taken).
They could.
but.... running PGO is just too much pain.
We can't do it "incrementally", can we? How about combining with LTO?
edit: I was thinking profiling individual module on a test driver and link them after PGO
I don't know if an optimization is allowed to "invent" a write, but I would be surprised if an optimizer goes that far because I have to believe that the number of cases where more writes improve performance are pretty slim.
a simple perf stat should show that the "Keep 50% of random data" case will have insanely more branch mis-predictions that the others.
Keep in mind that this is a synthetic benchmark. The task is to remove outliers and for that the roughly 99% correct guesses of the branch predictor is perfectly fine.