llvm.org GIT mirror llvm / a1643ba
add a note. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45388 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
1 changed file(s) with 35 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
479479 }
480480 }
481481
482
483
484 //===---------------------------------------------------------------------===//
482 //===---------------------------------------------------------------------===//
483
484 We should investigate an instruction sinking pass. Consider this silly
485 example in pic mode:
486
487 #include
488 void foo(int x) {
489 assert(x);
490 //...
491 }
492
493 we compile this to:
494 _foo:
495 subl $28, %esp
496 call "L1$pb"
497 "L1$pb":
498 popl %eax
499 cmpl $0, 32(%esp)
500 je LBB1_2 # cond_true
501 LBB1_1: # return
502 # ...
503 addl $28, %esp
504 ret
505 LBB1_2: # cond_true
506 ...
507
508 The PIC base computation (call+popl) is only used on one path through the
509 code, but is currently always computed in the entry block. It would be
510 better to sink the picbase computation down into the block for the
511 assertion, as it is the only one that uses it. This happens for a lot of
512 code with early outs.
513
514 In this case, whole-function-isel would also handle this.
515
516 //===---------------------------------------------------------------------===//