This is an archive of the discontinued LLVM Phabricator instance.

Use movw/movt instead of constant pool loads to lower byval parameter copies
ClosedPublic

Authored by dschuff on Mar 19 2015, 9:23 AM.

Details

Summary

The ARM backend can use a loop to implement copying byval parameters before
a call. In non-thumb2 mode it uses a constant pool load to materialize the
trip count. For targets that need movt instead (e.g. Native Client), use
the same code as in thumb2 mode to materialize the trip count.

Diff Detail

Repository
rL LLVM

Event Timeline

dschuff updated this revision to Diff 22262.Mar 19 2015, 9:23 AM
dschuff retitled this revision from to Use movw/movt instead of constant pool loads to lower byval parameter copies.
dschuff updated this object.
dschuff added a reviewer: jfb.
dschuff added a subscriber: Unknown Object (MLST).
jfb edited edge metadata.Mar 19 2015, 9:47 AM
jfb added subscribers: t.p.northover, echristo.

lgtm, I'd leave open for a short while if a wild @echristo or @t.p.northover appear.

Couple of minor points:

lib/Target/ARM/ARMISelLowering.cpp
7143 ↗(On Diff #22262)

Couldn't this be simplified to just Subtarget->useMovt(*MF)?

test/CodeGen/ARM/struct_byval.ll
6 ↗(On Diff #22262)

Not tests like this are a bit sketchy. There's a massive range of incorrect behaviour that could be produced but get past. Especially as you've actually added ARM code, I think you should be testing that's correct.

It'd also be good to make sure we don't try to produce movw/movt on CPUs that don't actually have them. That's surprisingly easy to do with C++ code manually using BuildMI.

dschuff updated this revision to Diff 22586.Mar 24 2015, 11:14 AM
dschuff edited edge metadata.
  • tnorthover review

thanks for the review.

lib/Target/ARM/ARMISelLowering.cpp
7143 ↗(On Diff #22262)

Yes, done.

test/CodeGen/ARM/struct_byval.ll
6 ↗(On Diff #22262)

Done.

This revision was automatically updated to reflect the committed changes.