Running the attached testcase with trunk r131577 on SPU with -dm -fmodulo-sched -O2 flags (which enables also do-loop optimization) demonstartes the fact that the branch probability is not reserved with do-loop optimization. This causes a major preformance regression (of about 40%) when tested with some similar benchmark as there is no hardware branch prediction on SPU.
Created attachment 14955 [details] The testcase
Can you show in an RTL dump why you are sure that the branch probabilities are lost?
(In reply to comment #2) > Can you show in an RTL dump why you are sure that the branch probabilities are > lost? Sure, I am currently testing a patch we have to fix this problem, the following '-' lines are from the SMS dump generated with current trunk and the '+' lines are generated from trunk containing the fix. @@ -1955,7 +1955,7 @@ (if_then_else (ne:SI (reg:SI 204 [ n ]) (const_int 0 [0x0])) (label_ref:SI 145) - (pc))) 356 {*spu.md:3450} (expr_list:REG_BR_PROB (const_int 5000 [0x1388]) + (pc))) 356 {*spu.md:3450} (expr_list:REG_BR_PROB (const_int 9100 [0x238c]) (nil))) ;; End of basic block 8 -> ( 10 9) ;; lr out 1 [$sp] 127 [$127] 128 [$vfp] 129 [$vap] 176 177 178 179 180 181 183 201 204 @@ -2015,8 +2015,8 @@ ;; reg 204 { d110(bb 8 insn 104) } -;; Succ edge 10 [50.0%] (dfs_back) -;; Succ edge 9 [50.0%] (fallthru,loop_exit) +;; Succ edge 10 [91.0%] (dfs_back) +;; Succ edge 9 [9.0%] (fallthru,loop_exit)
A patch was committed to trunk -r131604
Fixed.