This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 0003-Improve-VBEout-computation.patch


On 06/16/10 11:03, Maxim Kuvyrkov wrote:
On 6/16/10 8:57 PM, Paolo Bonzini wrote:
+  that are calculated along every path from BB.
+ E.g., it will not try to optimize the following case:
+
+ 2
+ | \
+ 3* |
+ | /
+ 4
+ / \
+ 5* 6
+
+ ;; "*" marks basic blocks that calculate same expression
+ ;; Ideally, all calculation would be moved to block 2.

No, this pessimizes the path 2->4->6.

Code hoisting is used only when optimizing for size, otherwise PRE is used. Maybe I'm missing something, but /speed/ regression of the path 2->4->6 is acceptable as long as overall code size goes down.
Well, within certain limits, a speed regression would be acceptable. But what is more important is the correctness issue.

Hoisting the expression into block #2 would introduce an evaluation of the expression on a path which did not have an evaluation in the original code (2->4->6) -- which could potentially cause a conforming program to begin to fail. This can occur for memory references or other instructions that might potentially trap/fault on invalid input.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]