Tree-SSA-passes.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU Compiler Collection (GCC) Internals: Tree SSA passes</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Tree SSA passes">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Tree SSA passes">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Passes.html#Passes" rel="up" title="Passes">
  30. <link href="RTL-passes.html#RTL-passes" rel="next" title="RTL passes">
  31. <link href="Pass-manager.html#Pass-manager" rel="prev" title="Pass manager">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Tree-SSA-passes"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="RTL-passes.html#RTL-passes" accesskey="n" rel="next">RTL passes</a>, Previous: <a href="Pass-manager.html#Pass-manager" accesskey="p" rel="prev">Pass manager</a>, Up: <a href="Passes.html#Passes" accesskey="u" rel="up">Passes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="Tree-SSA-passes-1"></a>
  69. <h3 class="section">9.5 Tree SSA passes</h3>
  70. <p>The following briefly describes the Tree optimization passes that are
  71. run after gimplification and what source files they are located in.
  72. </p>
  73. <ul>
  74. <li> Remove useless statements
  75. <p>This pass is an extremely simple sweep across the gimple code in which
  76. we identify obviously dead code and remove it. Here we do things like
  77. simplify <code>if</code> statements with constant conditions, remove
  78. exception handling constructs surrounding code that obviously cannot
  79. throw, remove lexical bindings that contain no variables, and other
  80. assorted simplistic cleanups. The idea is to get rid of the obvious
  81. stuff quickly rather than wait until later when it&rsquo;s more work to get
  82. rid of it. This pass is located in <samp>tree-cfg.c</samp> and described by
  83. <code>pass_remove_useless_stmts</code>.
  84. </p>
  85. </li><li> OpenMP lowering
  86. <p>If OpenMP generation (<samp>-fopenmp</samp>) is enabled, this pass lowers
  87. OpenMP constructs into GIMPLE.
  88. </p>
  89. <p>Lowering of OpenMP constructs involves creating replacement
  90. expressions for local variables that have been mapped using data
  91. sharing clauses, exposing the control flow of most synchronization
  92. directives and adding region markers to facilitate the creation of the
  93. control flow graph. The pass is located in <samp>omp-low.c</samp> and is
  94. described by <code>pass_lower_omp</code>.
  95. </p>
  96. </li><li> OpenMP expansion
  97. <p>If OpenMP generation (<samp>-fopenmp</samp>) is enabled, this pass expands
  98. parallel regions into their own functions to be invoked by the thread
  99. library. The pass is located in <samp>omp-low.c</samp> and is described by
  100. <code>pass_expand_omp</code>.
  101. </p>
  102. </li><li> Lower control flow
  103. <p>This pass flattens <code>if</code> statements (<code>COND_EXPR</code>)
  104. and moves lexical bindings (<code>BIND_EXPR</code>) out of line. After
  105. this pass, all <code>if</code> statements will have exactly two <code>goto</code>
  106. statements in its <code>then</code> and <code>else</code> arms. Lexical binding
  107. information for each statement will be found in <code>TREE_BLOCK</code> rather
  108. than being inferred from its position under a <code>BIND_EXPR</code>. This
  109. pass is found in <samp>gimple-low.c</samp> and is described by
  110. <code>pass_lower_cf</code>.
  111. </p>
  112. </li><li> Lower exception handling control flow
  113. <p>This pass decomposes high-level exception handling constructs
  114. (<code>TRY_FINALLY_EXPR</code> and <code>TRY_CATCH_EXPR</code>) into a form
  115. that explicitly represents the control flow involved. After this
  116. pass, <code>lookup_stmt_eh_region</code> will return a non-negative
  117. number for any statement that may have EH control flow semantics;
  118. examine <code>tree_can_throw_internal</code> or <code>tree_can_throw_external</code>
  119. for exact semantics. Exact control flow may be extracted from
  120. <code>foreach_reachable_handler</code>. The EH region nesting tree is defined
  121. in <samp>except.h</samp> and built in <samp>except.c</samp>. The lowering pass
  122. itself is in <samp>tree-eh.c</samp> and is described by <code>pass_lower_eh</code>.
  123. </p>
  124. </li><li> Build the control flow graph
  125. <p>This pass decomposes a function into basic blocks and creates all of
  126. the edges that connect them. It is located in <samp>tree-cfg.c</samp> and
  127. is described by <code>pass_build_cfg</code>.
  128. </p>
  129. </li><li> Find all referenced variables
  130. <p>This pass walks the entire function and collects an array of all
  131. variables referenced in the function, <code>referenced_vars</code>. The
  132. index at which a variable is found in the array is used as a UID
  133. for the variable within this function. This data is needed by the
  134. SSA rewriting routines. The pass is located in <samp>tree-dfa.c</samp>
  135. and is described by <code>pass_referenced_vars</code>.
  136. </p>
  137. </li><li> Enter static single assignment form
  138. <p>This pass rewrites the function such that it is in SSA form. After
  139. this pass, all <code>is_gimple_reg</code> variables will be referenced by
  140. <code>SSA_NAME</code>, and all occurrences of other variables will be
  141. annotated with <code>VDEFS</code> and <code>VUSES</code>; PHI nodes will have
  142. been inserted as necessary for each basic block. This pass is
  143. located in <samp>tree-ssa.c</samp> and is described by <code>pass_build_ssa</code>.
  144. </p>
  145. </li><li> Warn for uninitialized variables
  146. <p>This pass scans the function for uses of <code>SSA_NAME</code>s that
  147. are fed by default definition. For non-parameter variables, such
  148. uses are uninitialized. The pass is run twice, before and after
  149. optimization (if turned on). In the first pass we only warn for uses that are
  150. positively uninitialized; in the second pass we warn for uses that
  151. are possibly uninitialized. The pass is located in <samp>tree-ssa.c</samp>
  152. and is defined by <code>pass_early_warn_uninitialized</code> and
  153. <code>pass_late_warn_uninitialized</code>.
  154. </p>
  155. </li><li> Dead code elimination
  156. <p>This pass scans the function for statements without side effects whose
  157. result is unused. It does not do memory life analysis, so any value
  158. that is stored in memory is considered used. The pass is run multiple
  159. times throughout the optimization process. It is located in
  160. <samp>tree-ssa-dce.c</samp> and is described by <code>pass_dce</code>.
  161. </p>
  162. </li><li> Dominator optimizations
  163. <p>This pass performs trivial dominator-based copy and constant propagation,
  164. expression simplification, and jump threading. It is run multiple times
  165. throughout the optimization process. It is located in <samp>tree-ssa-dom.c</samp>
  166. and is described by <code>pass_dominator</code>.
  167. </p>
  168. </li><li> Forward propagation of single-use variables
  169. <p>This pass attempts to remove redundant computation by substituting
  170. variables that are used once into the expression that uses them and
  171. seeing if the result can be simplified. It is located in
  172. <samp>tree-ssa-forwprop.c</samp> and is described by <code>pass_forwprop</code>.
  173. </p>
  174. </li><li> Copy Renaming
  175. <p>This pass attempts to change the name of compiler temporaries involved in
  176. copy operations such that SSA-&gt;normal can coalesce the copy away. When compiler
  177. temporaries are copies of user variables, it also renames the compiler
  178. temporary to the user variable resulting in better use of user symbols. It is
  179. located in <samp>tree-ssa-copyrename.c</samp> and is described by
  180. <code>pass_copyrename</code>.
  181. </p>
  182. </li><li> PHI node optimizations
  183. <p>This pass recognizes forms of PHI inputs that can be represented as
  184. conditional expressions and rewrites them into straight line code.
  185. It is located in <samp>tree-ssa-phiopt.c</samp> and is described by
  186. <code>pass_phiopt</code>.
  187. </p>
  188. </li><li> May-alias optimization
  189. <p>This pass performs a flow sensitive SSA-based points-to analysis.
  190. The resulting may-alias, must-alias, and escape analysis information
  191. is used to promote variables from in-memory addressable objects to
  192. non-aliased variables that can be renamed into SSA form. We also
  193. update the <code>VDEF</code>/<code>VUSE</code> memory tags for non-renameable
  194. aggregates so that we get fewer false kills. The pass is located
  195. in <samp>tree-ssa-alias.c</samp> and is described by <code>pass_may_alias</code>.
  196. </p>
  197. <p>Interprocedural points-to information is located in
  198. <samp>tree-ssa-structalias.c</samp> and described by <code>pass_ipa_pta</code>.
  199. </p>
  200. </li><li> Profiling
  201. <p>This pass instruments the function in order to collect runtime block
  202. and value profiling data. Such data may be fed back into the compiler
  203. on a subsequent run so as to allow optimization based on expected
  204. execution frequencies. The pass is located in <samp>tree-profile.c</samp> and
  205. is described by <code>pass_ipa_tree_profile</code>.
  206. </p>
  207. </li><li> Static profile estimation
  208. <p>This pass implements series of heuristics to guess propababilities
  209. of branches. The resulting predictions are turned into edge profile
  210. by propagating branches across the control flow graphs.
  211. The pass is located in <samp>tree-profile.c</samp> and is described by
  212. <code>pass_profile</code>.
  213. </p>
  214. </li><li> Lower complex arithmetic
  215. <p>This pass rewrites complex arithmetic operations into their component
  216. scalar arithmetic operations. The pass is located in <samp>tree-complex.c</samp>
  217. and is described by <code>pass_lower_complex</code>.
  218. </p>
  219. </li><li> Scalar replacement of aggregates
  220. <p>This pass rewrites suitable non-aliased local aggregate variables into
  221. a set of scalar variables. The resulting scalar variables are
  222. rewritten into SSA form, which allows subsequent optimization passes
  223. to do a significantly better job with them. The pass is located in
  224. <samp>tree-sra.c</samp> and is described by <code>pass_sra</code>.
  225. </p>
  226. </li><li> Dead store elimination
  227. <p>This pass eliminates stores to memory that are subsequently overwritten
  228. by another store, without any intervening loads. The pass is located
  229. in <samp>tree-ssa-dse.c</samp> and is described by <code>pass_dse</code>.
  230. </p>
  231. </li><li> Tail recursion elimination
  232. <p>This pass transforms tail recursion into a loop. It is located in
  233. <samp>tree-tailcall.c</samp> and is described by <code>pass_tail_recursion</code>.
  234. </p>
  235. </li><li> Forward store motion
  236. <p>This pass sinks stores and assignments down the flowgraph closer to their
  237. use point. The pass is located in <samp>tree-ssa-sink.c</samp> and is
  238. described by <code>pass_sink_code</code>.
  239. </p>
  240. </li><li> Partial redundancy elimination
  241. <p>This pass eliminates partially redundant computations, as well as
  242. performing load motion. The pass is located in <samp>tree-ssa-pre.c</samp>
  243. and is described by <code>pass_pre</code>.
  244. </p>
  245. <p>Just before partial redundancy elimination, if
  246. <samp>-funsafe-math-optimizations</samp> is on, GCC tries to convert
  247. divisions to multiplications by the reciprocal. The pass is located
  248. in <samp>tree-ssa-math-opts.c</samp> and is described by
  249. <code>pass_cse_reciprocal</code>.
  250. </p>
  251. </li><li> Full redundancy elimination
  252. <p>This is a simpler form of PRE that only eliminates redundancies that
  253. occur on all paths. It is located in <samp>tree-ssa-pre.c</samp> and
  254. described by <code>pass_fre</code>.
  255. </p>
  256. </li><li> Loop optimization
  257. <p>The main driver of the pass is placed in <samp>tree-ssa-loop.c</samp>
  258. and described by <code>pass_loop</code>.
  259. </p>
  260. <p>The optimizations performed by this pass are:
  261. </p>
  262. <p>Loop invariant motion. This pass moves only invariants that
  263. would be hard to handle on RTL level (function calls, operations that expand to
  264. nontrivial sequences of insns). With <samp>-funswitch-loops</samp> it also moves
  265. operands of conditions that are invariant out of the loop, so that we can use
  266. just trivial invariantness analysis in loop unswitching. The pass also includes
  267. store motion. The pass is implemented in <samp>tree-ssa-loop-im.c</samp>.
  268. </p>
  269. <p>Canonical induction variable creation. This pass creates a simple counter
  270. for number of iterations of the loop and replaces the exit condition of the
  271. loop using it, in case when a complicated analysis is necessary to determine
  272. the number of iterations. Later optimizations then may determine the number
  273. easily. The pass is implemented in <samp>tree-ssa-loop-ivcanon.c</samp>.
  274. </p>
  275. <p>Induction variable optimizations. This pass performs standard induction
  276. variable optimizations, including strength reduction, induction variable
  277. merging and induction variable elimination. The pass is implemented in
  278. <samp>tree-ssa-loop-ivopts.c</samp>.
  279. </p>
  280. <p>Loop unswitching. This pass moves the conditional jumps that are invariant
  281. out of the loops. To achieve this, a duplicate of the loop is created for
  282. each possible outcome of conditional jump(s). The pass is implemented in
  283. <samp>tree-ssa-loop-unswitch.c</samp>.
  284. </p>
  285. <p>Loop splitting. If a loop contains a conditional statement that is
  286. always true for one part of the iteration space and false for the other
  287. this pass splits the loop into two, one dealing with one side the other
  288. only with the other, thereby removing one inner-loop conditional. The
  289. pass is implemented in <samp>tree-ssa-loop-split.c</samp>.
  290. </p>
  291. <p>The optimizations also use various utility functions contained in
  292. <samp>tree-ssa-loop-manip.c</samp>, <samp>cfgloop.c</samp>, <samp>cfgloopanal.c</samp> and
  293. <samp>cfgloopmanip.c</samp>.
  294. </p>
  295. <p>Vectorization. This pass transforms loops to operate on vector types
  296. instead of scalar types. Data parallelism across loop iterations is exploited
  297. to group data elements from consecutive iterations into a vector and operate
  298. on them in parallel. Depending on available target support the loop is
  299. conceptually unrolled by a factor <code>VF</code> (vectorization factor), which is
  300. the number of elements operated upon in parallel in each iteration, and the
  301. <code>VF</code> copies of each scalar operation are fused to form a vector operation.
  302. Additional loop transformations such as peeling and versioning may take place
  303. to align the number of iterations, and to align the memory accesses in the
  304. loop.
  305. The pass is implemented in <samp>tree-vectorizer.c</samp> (the main driver),
  306. <samp>tree-vect-loop.c</samp> and <samp>tree-vect-loop-manip.c</samp> (loop specific parts
  307. and general loop utilities), <samp>tree-vect-slp</samp> (loop-aware SLP
  308. functionality), <samp>tree-vect-stmts.c</samp> and <samp>tree-vect-data-refs.c</samp>.
  309. Analysis of data references is in <samp>tree-data-ref.c</samp>.
  310. </p>
  311. <p>SLP Vectorization. This pass performs vectorization of straight-line code. The
  312. pass is implemented in <samp>tree-vectorizer.c</samp> (the main driver),
  313. <samp>tree-vect-slp.c</samp>, <samp>tree-vect-stmts.c</samp> and
  314. <samp>tree-vect-data-refs.c</samp>.
  315. </p>
  316. <p>Autoparallelization. This pass splits the loop iteration space to run
  317. into several threads. The pass is implemented in <samp>tree-parloops.c</samp>.
  318. </p>
  319. <p>Graphite is a loop transformation framework based on the polyhedral
  320. model. Graphite stands for Gimple Represented as Polyhedra. The
  321. internals of this infrastructure are documented in
  322. <a href="http://gcc.gnu.org/wiki/Graphite">http://gcc.gnu.org/wiki/Graphite</a><!-- /@w -->. The passes working on
  323. this representation are implemented in the various <samp>graphite-*</samp>
  324. files.
  325. </p>
  326. </li><li> Tree level if-conversion for vectorizer
  327. <p>This pass applies if-conversion to simple loops to help vectorizer.
  328. We identify if convertible loops, if-convert statements and merge
  329. basic blocks in one big block. The idea is to present loop in such
  330. form so that vectorizer can have one to one mapping between statements
  331. and available vector operations. This pass is located in
  332. <samp>tree-if-conv.c</samp> and is described by <code>pass_if_conversion</code>.
  333. </p>
  334. </li><li> Conditional constant propagation
  335. <p>This pass relaxes a lattice of values in order to identify those
  336. that must be constant even in the presence of conditional branches.
  337. The pass is located in <samp>tree-ssa-ccp.c</samp> and is described
  338. by <code>pass_ccp</code>.
  339. </p>
  340. <p>A related pass that works on memory loads and stores, and not just
  341. register values, is located in <samp>tree-ssa-ccp.c</samp> and described by
  342. <code>pass_store_ccp</code>.
  343. </p>
  344. </li><li> Conditional copy propagation
  345. <p>This is similar to constant propagation but the lattice of values is
  346. the &ldquo;copy-of&rdquo; relation. It eliminates redundant copies from the
  347. code. The pass is located in <samp>tree-ssa-copy.c</samp> and described by
  348. <code>pass_copy_prop</code>.
  349. </p>
  350. <p>A related pass that works on memory copies, and not just register
  351. copies, is located in <samp>tree-ssa-copy.c</samp> and described by
  352. <code>pass_store_copy_prop</code>.
  353. </p>
  354. </li><li> Value range propagation
  355. <p>This transformation is similar to constant propagation but
  356. instead of propagating single constant values, it propagates
  357. known value ranges. The implementation is based on Patterson&rsquo;s
  358. range propagation algorithm (Accurate Static Branch Prediction by
  359. Value Range Propagation, J. R. C. Patterson, PLDI &rsquo;95). In
  360. contrast to Patterson&rsquo;s algorithm, this implementation does not
  361. propagate branch probabilities nor it uses more than a single
  362. range per SSA name. This means that the current implementation
  363. cannot be used for branch prediction (though adapting it would
  364. not be difficult). The pass is located in <samp>tree-vrp.c</samp> and is
  365. described by <code>pass_vrp</code>.
  366. </p>
  367. </li><li> Folding built-in functions
  368. <p>This pass simplifies built-in functions, as applicable, with constant
  369. arguments or with inferable string lengths. It is located in
  370. <samp>tree-ssa-ccp.c</samp> and is described by <code>pass_fold_builtins</code>.
  371. </p>
  372. </li><li> Split critical edges
  373. <p>This pass identifies critical edges and inserts empty basic blocks
  374. such that the edge is no longer critical. The pass is located in
  375. <samp>tree-cfg.c</samp> and is described by <code>pass_split_crit_edges</code>.
  376. </p>
  377. </li><li> Control dependence dead code elimination
  378. <p>This pass is a stronger form of dead code elimination that can
  379. eliminate unnecessary control flow statements. It is located
  380. in <samp>tree-ssa-dce.c</samp> and is described by <code>pass_cd_dce</code>.
  381. </p>
  382. </li><li> Tail call elimination
  383. <p>This pass identifies function calls that may be rewritten into
  384. jumps. No code transformation is actually applied here, but the
  385. data and control flow problem is solved. The code transformation
  386. requires target support, and so is delayed until RTL. In the
  387. meantime <code>CALL_EXPR_TAILCALL</code> is set indicating the possibility.
  388. The pass is located in <samp>tree-tailcall.c</samp> and is described by
  389. <code>pass_tail_calls</code>. The RTL transformation is handled by
  390. <code>fixup_tail_calls</code> in <samp>calls.c</samp>.
  391. </p>
  392. </li><li> Warn for function return without value
  393. <p>For non-void functions, this pass locates return statements that do
  394. not specify a value and issues a warning. Such a statement may have
  395. been injected by falling off the end of the function. This pass is
  396. run last so that we have as much time as possible to prove that the
  397. statement is not reachable. It is located in <samp>tree-cfg.c</samp> and
  398. is described by <code>pass_warn_function_return</code>.
  399. </p>
  400. </li><li> Leave static single assignment form
  401. <p>This pass rewrites the function such that it is in normal form. At
  402. the same time, we eliminate as many single-use temporaries as possible,
  403. so the intermediate language is no longer GIMPLE, but GENERIC. The
  404. pass is located in <samp>tree-outof-ssa.c</samp> and is described by
  405. <code>pass_del_ssa</code>.
  406. </p>
  407. </li><li> Merge PHI nodes that feed into one another
  408. <p>This is part of the CFG cleanup passes. It attempts to join PHI nodes
  409. from a forwarder CFG block into another block with PHI nodes. The
  410. pass is located in <samp>tree-cfgcleanup.c</samp> and is described by
  411. <code>pass_merge_phi</code>.
  412. </p>
  413. </li><li> Return value optimization
  414. <p>If a function always returns the same local variable, and that local
  415. variable is an aggregate type, then the variable is replaced with the
  416. return value for the function (i.e., the function&rsquo;s DECL_RESULT). This
  417. is equivalent to the C++ named return value optimization applied to
  418. GIMPLE. The pass is located in <samp>tree-nrv.c</samp> and is described by
  419. <code>pass_nrv</code>.
  420. </p>
  421. </li><li> Return slot optimization
  422. <p>If a function returns a memory object and is called as <code>var =
  423. foo()</code>, this pass tries to change the call so that the address of
  424. <code>var</code> is sent to the caller to avoid an extra memory copy. This
  425. pass is located in <code>tree-nrv.c</code> and is described by
  426. <code>pass_return_slot</code>.
  427. </p>
  428. </li><li> Optimize calls to <code>__builtin_object_size</code>
  429. <p>This is a propagation pass similar to CCP that tries to remove calls
  430. to <code>__builtin_object_size</code> when the size of the object can be
  431. computed at compile-time. This pass is located in
  432. <samp>tree-object-size.c</samp> and is described by
  433. <code>pass_object_sizes</code>.
  434. </p>
  435. </li><li> Loop invariant motion
  436. <p>This pass removes expensive loop-invariant computations out of loops.
  437. The pass is located in <samp>tree-ssa-loop.c</samp> and described by
  438. <code>pass_lim</code>.
  439. </p>
  440. </li><li> Loop nest optimizations
  441. <p>This is a family of loop transformations that works on loop nests. It
  442. includes loop interchange, scaling, skewing and reversal and they are
  443. all geared to the optimization of data locality in array traversals
  444. and the removal of dependencies that hamper optimizations such as loop
  445. parallelization and vectorization. The pass is located in
  446. <samp>tree-loop-linear.c</samp> and described by
  447. <code>pass_linear_transform</code>.
  448. </p>
  449. </li><li> Removal of empty loops
  450. <p>This pass removes loops with no code in them. The pass is located in
  451. <samp>tree-ssa-loop-ivcanon.c</samp> and described by
  452. <code>pass_empty_loop</code>.
  453. </p>
  454. </li><li> Unrolling of small loops
  455. <p>This pass completely unrolls loops with few iterations. The pass
  456. is located in <samp>tree-ssa-loop-ivcanon.c</samp> and described by
  457. <code>pass_complete_unroll</code>.
  458. </p>
  459. </li><li> Predictive commoning
  460. <p>This pass makes the code reuse the computations from the previous
  461. iterations of the loops, especially loads and stores to memory.
  462. It does so by storing the values of these computations to a bank
  463. of temporary variables that are rotated at the end of loop. To avoid
  464. the need for this rotation, the loop is then unrolled and the copies
  465. of the loop body are rewritten to use the appropriate version of
  466. the temporary variable. This pass is located in <samp>tree-predcom.c</samp>
  467. and described by <code>pass_predcom</code>.
  468. </p>
  469. </li><li> Array prefetching
  470. <p>This pass issues prefetch instructions for array references inside
  471. loops. The pass is located in <samp>tree-ssa-loop-prefetch.c</samp> and
  472. described by <code>pass_loop_prefetch</code>.
  473. </p>
  474. </li><li> Reassociation
  475. <p>This pass rewrites arithmetic expressions to enable optimizations that
  476. operate on them, like redundancy elimination and vectorization. The
  477. pass is located in <samp>tree-ssa-reassoc.c</samp> and described by
  478. <code>pass_reassoc</code>.
  479. </p>
  480. </li><li> Optimization of <code>stdarg</code> functions
  481. <p>This pass tries to avoid the saving of register arguments into the
  482. stack on entry to <code>stdarg</code> functions. If the function doesn&rsquo;t
  483. use any <code>va_start</code> macros, no registers need to be saved. If
  484. <code>va_start</code> macros are used, the <code>va_list</code> variables don&rsquo;t
  485. escape the function, it is only necessary to save registers that will
  486. be used in <code>va_arg</code> macros. For instance, if <code>va_arg</code> is
  487. only used with integral types in the function, floating point
  488. registers don&rsquo;t need to be saved. This pass is located in
  489. <code>tree-stdarg.c</code> and described by <code>pass_stdarg</code>.
  490. </p>
  491. </li></ul>
  492. <hr>
  493. <div class="header">
  494. <p>
  495. Next: <a href="RTL-passes.html#RTL-passes" accesskey="n" rel="next">RTL passes</a>, Previous: <a href="Pass-manager.html#Pass-manager" accesskey="p" rel="prev">Pass manager</a>, Up: <a href="Passes.html#Passes" accesskey="u" rel="up">Passes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  496. </div>
  497. </body>
  498. </html>