[llvm-commits] Dead argument elimination rewrite

Matthijs Kooijman m.kooijman at student.utwente.nl
Thu Jun 19 08:56:22 PDT 2008


> Ok. Would you mind taking a look at timings on
> MultiSource/Applications/kimwitu++ also?
Are you particularly interested in timings? It seems that this testcase
actually fails to compile due to some older bug. I just tested this with the
old DAE code, which also shows problems (but a somewhat different problem it
seems).

Anyway, the problem is the ExtraArgHack. This code makes sure that a vararg
will never have all of its arguments removed by inserting a dummy argument if
all if its arguments are dead. According to the comments, this is to make cbe
happy. However, the code would also change vararg functions that had no
parameters to start with.

In the old code this would also happen if the return value was dead, in the
new code this would happen on every function (including externals..). I've now
modified the code to only apply the extraarghack on functions that were not
already argumentless, there is a small chance of this breaking cbe output for
bc files containing argumentless vararg functions (but that was the same for
the old code, with the exception of those functions with dead return values).

Also, I've added a quick return path to RemoveStuffFromFunction for external
functions (that saves iterating all arguments and return values, which are by
definition live, only to find that the new function type would be the same as
the old).

As for the timings, IIRC (I'm away from work atm) the fixed version runs just
as fast as the original code.


> When DAE creates a new function, it inserts the function into the list  in
> the position of the old function, so as far as I can tell DAE shouldn't
> ever end up calling RemoveDeadStuffFromFunction on one of the new functions.
Ah right, I missed that detail when I copied that part of the old code :-)

I've updated this.

Gr.

Matthijs



More information about the llvm-commits mailing list