mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-16 11:24:39 +00:00
[PerformanceTips] Document various items folks have suggested
This could stand to be expanded - patches welcome! - but let's at least write them down so they don't get forgotten. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230995 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -47,6 +47,51 @@ operations for safety. If your source language provides information about
|
|||||||
the range of the index, you may wish to manually extend indices to machine
|
the range of the index, you may wish to manually extend indices to machine
|
||||||
register width using a zext instruction.
|
register width using a zext instruction.
|
||||||
|
|
||||||
|
Other things to consider
|
||||||
|
=========================
|
||||||
|
|
||||||
|
#. Make sure that a DataLayout is provided (this will likely become required in
|
||||||
|
the near future, but is certainly important for optimization).
|
||||||
|
|
||||||
|
#. Add nsw/nuw/fast-math flags as appropriate
|
||||||
|
|
||||||
|
#. Add noalias/align/dereferenceable/nonnull to function arguments and return
|
||||||
|
values as appropriate
|
||||||
|
|
||||||
|
#. Mark functions as readnone/readonly/nounwind when known (especially for
|
||||||
|
external functions)
|
||||||
|
|
||||||
|
#. Use ptrtoint/inttoptr sparingly (they interfere with pointer aliasing
|
||||||
|
analysis), prefer GEPs
|
||||||
|
|
||||||
|
#. Use the lifetime.start/lifetime.end and invariant.start/invariant.end
|
||||||
|
intrinsics where possible. Common profitable uses are for stack like data
|
||||||
|
structures (thus allowing dead store elimination) and for describing
|
||||||
|
life times of allocas (thus allowing smaller stack sizes).
|
||||||
|
|
||||||
|
#. Use pointer aliasing metadata, especially tbaa metadata, to communicate
|
||||||
|
otherwise-non-deducible pointer aliasing facts
|
||||||
|
|
||||||
|
#. Use the "most-private" possible linkage types for the functions being defined
|
||||||
|
(private, internal or linkonce_odr preferably)
|
||||||
|
|
||||||
|
#. Mark invariant locations using !invariant.load and TBAA's constant flags
|
||||||
|
|
||||||
|
#. Prefer globals over inttoptr of a constant address - this gives you
|
||||||
|
dereferencability information. In MCJIT, use getSymbolAddress to provide
|
||||||
|
actual address.
|
||||||
|
|
||||||
|
#. Be wary of ordered and atomic memory operations. They are hard to optimize
|
||||||
|
and may not be well optimized by the current optimizer. Depending on your
|
||||||
|
source language, you may consider using fences instead.
|
||||||
|
|
||||||
|
#. If you language uses range checks, consider using the IRCE pass. It is not
|
||||||
|
currently part of the standard pass order.
|
||||||
|
|
||||||
|
p.s. If you want to help improve this document, patches expanding any of the
|
||||||
|
above items into standalone sections of their own with a more complete
|
||||||
|
discussion would be very welcome.
|
||||||
|
|
||||||
|
|
||||||
Adding to this document
|
Adding to this document
|
||||||
=======================
|
=======================
|
||||||
|
Reference in New Issue
Block a user