Bug 34826 - branch probability is not updated with do-loop optimization
Summary: branch probability is not updated with do-loop optimization
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-17 07:18 UTC by revital eres
Modified: 2008-01-20 04:52 UTC (History)
3 users (show)

See Also:
Host:
Target: spu-elf
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
The testcase (270 bytes, text/plain)
2008-01-17 07:21 UTC, revital eres
Details

Note You need to log in before you can comment on or make changes to this bug.
Description revital eres 2008-01-17 07:18:30 UTC
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.
Comment 1 revital eres 2008-01-17 07:21:05 UTC
Created attachment 14955 [details]
The testcase
Comment 2 Steven Bosscher 2008-01-17 07:31:18 UTC
Can you show in an RTL dump why you are sure that the branch probabilities are lost?
Comment 3 revital eres 2008-01-17 08:17:45 UTC
(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)
Comment 4 revital eres 2008-01-17 18:28:31 UTC
A patch was committed to trunk -r131604
Comment 5 Andrew Pinski 2008-01-20 04:52:28 UTC
Fixed.