This is an archive of the discontinued LLVM Phabricator instance.

Make TwoAddressInstructionPass::rescheduleMIBelowKill subreg-aware
ClosedPublic

Authored by mkuper on Aug 5 2016, 12:24 PM.

Details

Summary

This fixes PR28824

I'm mostly wondering if we already have something like regOverlapsSet() around.
I couldn't find one, but it sounds like it ought to exist.

(The registers in the test are explicit on purpose - for the mov, ecx is ABI-mandated, and for the shift, it's a special instruction form that we want to be using.)

Diff Detail

Repository
rL LLVM

Event Timeline

mkuper updated this revision to Diff 66990.Aug 5 2016, 12:24 PM
mkuper retitled this revision from to Make TwoAddressInstructionPass::rescheduleMIBelowKill subreg-aware.
mkuper updated this object.
mkuper added a reviewer: echristo.
mkuper added a subscriber: llvm-commits.
majnemer added inline comments.
lib/CodeGen/TwoAddressInstructionPass.cpp
545 ↗(On Diff #66990)

Formatting.

Thanks David, will fix the formatting!
What I'd really like, though, is to get rid of that function entirely - assuming there's something like this hiding somewhere else in the codebase. :-)

hans added a subscriber: hans.Aug 10 2016, 1:15 PM
MatzeB edited edge metadata.Aug 10 2016, 5:16 PM

I guess you can use a SmallVector now if all you do is iterating over all elements of the container.

I guess you can use a SmallVector now if all you do is iterating over all elements of the container.

I guess you're right. I left it as a set to avoid duplicates, but we shouldn't have those anyway, at least not in the common case.

MatzeB accepted this revision.Aug 10 2016, 5:19 PM
MatzeB edited edge metadata.

LGTM with a change to SmallVector.

This revision is now accepted and ready to land.Aug 10 2016, 5:19 PM

I guess you can use a SmallVector now if all you do is iterating over all elements of the container.

I guess you're right. I left it as a set to avoid duplicates, but we shouldn't have those anyway, at least not in the common case.

There can be duplicates, but they shouldn't hurt. And it is probably more expensive to filter out the duplicates than just checking a register twice in the few cases where we actually have a duplicate.

Right, will change it to a SmallVector.
Thanks!

This revision was automatically updated to reflect the committed changes.