[PATCH] D29200: [JumpThread] Enhance finding partial redundant loads by continuing scanning single predecessor

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 07:47:29 PST 2017


dberlin added a comment.

Also, for the record, all of these testcases are fully redundant loads.

they are all of the form

  load
  if (...)
  {
  load
  }

This is a full redundancy. The initial load dominates the others, with nothing in between, and so they are fully redundant This is also why every pass we have that does any load elimination will already eliminate them.

A partially redundant load would be

  if (a)
   load a
  else
    <nothing>
  load a

This load is partially redundant because it unnecessarily happens twice when we take the if(a)'s true branch

PRE will turn it into:

  if (a)
   load a
  else
   load a
  result = phi(...)

As mentioned, GVN already does this transformation, so i'd really like to see a testcase where you doing this in jump threading enables an optimization we don't get already.


Repository:
  rL LLVM

https://reviews.llvm.org/D29200





More information about the llvm-commits mailing list