README.txt 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. IRgen optimization opportunities.
  2. //===---------------------------------------------------------------------===//
  3. The common pattern of
  4. --
  5. short x; // or char, etc
  6. (x == 10)
  7. --
  8. generates an zext/sext of x which can easily be avoided.
  9. //===---------------------------------------------------------------------===//
  10. Bitfields accesses can be shifted to simplify masking and sign
  11. extension. For example, if the bitfield width is 8 and it is
  12. appropriately aligned then is is a lot shorter to just load the char
  13. directly.
  14. //===---------------------------------------------------------------------===//
  15. It may be worth avoiding creation of alloca's for formal arguments
  16. for the common situation where the argument is never written to or has
  17. its address taken. The idea would be to begin generating code by using
  18. the argument directly and if its address is taken or it is stored to
  19. then generate the alloca and patch up the existing code.
  20. In theory, the same optimization could be a win for block local
  21. variables as long as the declaration dominates all statements in the
  22. block.
  23. NOTE: The main case we care about this for is for -O0 -g compile time
  24. performance, and in that scenario we will need to emit the alloca
  25. anyway currently to emit proper debug info. So this is blocked by
  26. being able to emit debug information which refers to an LLVM
  27. temporary, not an alloca.
  28. //===---------------------------------------------------------------------===//
  29. We should try and avoid generating basic blocks which only contain
  30. jumps. At -O0, this penalizes us all the way from IRgen (malloc &
  31. instruction overhead), all the way down through code generation and
  32. assembly time.
  33. On 176.gcc:expr.ll, it looks like over 12% of basic blocks are just
  34. direct branches!
  35. //===---------------------------------------------------------------------===//