This is an archive of the discontinued LLVM Phabricator instance.

ARM: allow ConstantIslands to handle jump tables
ClosedPublic

Authored by t.p.northover on May 15 2015, 10:42 AM.

Details

Reviewers
pete
Summary

Hi,

In some cases (see the new test-case, but basically phi elimination dumping millions of copies at the end of a block) a jump table's final jump can be moved too far away from the ADR instruction that calculates its base address to be reached.

There are a couple of solutions possible here: fuse jump table instructions together into one big barrier, or allow ConstantIslands to move the actual tables around to ensure they are in range. I decided the latter was probably less hacky, though still not trivial.

I've tested it by running LNT (ARM & Thumb, though both v7) with no regressions, but ConstantIslands is always a precarious pass to modify, so I'd really welcome some more eyes on the patch.

Cheers.

Tim.

Diff Detail

Repository
rL LLVM

Event Timeline

t.p.northover retitled this revision from to ARM: allow ConstantIslands to handle jump tables.
t.p.northover updated this object.
t.p.northover edited the test plan for this revision. (Show Details)
t.p.northover set the repository for this revision to rL LLVM.
t.p.northover added a subscriber: Unknown Object (MLST).May 15 2015, 10:49 AM

Bother, put LLVM in the wrong field. Commenting to get it to the list.

Tim.

pete accepted this revision.May 15 2015, 11:01 AM
pete added a reviewer: pete.
pete added a subscriber: pete.

Hey Tim.

A bunch of nitpicking, but nothing that should block committing. LGTM.

Cheers,
Pete

lib/Target/ARM/ARMAsmPrinter.cpp
1014

This can be a foreach.

lib/Target/ARM/ARMConstantIslandPass.cpp
516

Can you change this to \brief as you're changing these lines anyway.

578

And use \brief here too.

617

You do unsigned for JTI earlier in the patch. Would unsigned be better here?

2028

\brief here too.

This revision is now accepted and ready to land.May 15 2015, 11:01 AM

Thanks Pete. I've committed it (with your suggestions, which were all very sensible) as r237590.