[PATCH] D28934: Write a new SSAUpdater

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 19 19:17:43 PST 2017


dberlin created this revision.
Herald added a subscriber: mgorny.

This SSAUpdater has a simpler interface and even simpler
implementation than our current one.  It is both faster, and IMHO,
simpler to understand.  It also can be used for multiple variables at
once, and can be reused without destruction or worry.

It does not require dominance frontiers, dominators, etc, as our
current implementation does.

I originally wrote it for something else, but https://reviews.llvm.org/D28534 reminded me i had
it.  It implements the marker algorithm from "Simple and Efficient
Construction of Static Single Assignment Form" at
http://compilers.cs.uni-saarland.de/papers/bbhlmz13cc.pdf. It does not
create completely minimal SSA (so in some cases leaves a few phi
nodes).  I could make it do so by implementing the SCC algorithm in
the paper, at some implementation complexity cost.
The marker algorithm is superificially similar[1] to the current SSAUpdater,
but howwe place phi nodes is very different, and the API + implementation as
described is, IMHO, easier to understand :)

I also didn't implement the trivial recursive phi simplification (i
would rather just use the scc algorithm at that point, as it wouldn't
require recursive simplfication).

I do not pretend this version is ready to go in by far (it has no
tests, to start :P).  But before i spent any more time on it, i
figured i'd get general thoughts on whether people think it is worth
cleaning it up, or if we don't care enough about SSAUpdater as-is.

(Also, fair warning, it worked the last time i tried it, but i haven'
touched it in a while)

[1] If one stares at the implementation, written in 2009, and then the
paper, written in 2012, one may wonder if some credit is not missing
somewhere.


https://reviews.llvm.org/D28934

Files:
  include/llvm/Transforms/Utils/SSAUpdaterNew.h
  lib/Transforms/Utils/CMakeLists.txt
  lib/Transforms/Utils/SSAUpdaterNew.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28934.85093.patch
Type: text/x-patch
Size: 8833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170120/2224022f/attachment.bin>


More information about the llvm-commits mailing list