This is an archive of the discontinued LLVM Phabricator instance.

[X86] Correctly select registers to pop into for x86_64
ClosedPublic

Authored by mkuper on Mar 9 2016, 11:56 PM.

Details

Summary

When trying to replace an add to esp with pops, we need to choose dead registers to pop into.
Registers clobbered by the call and not imp-def'd by it should be safe. Except that it's not enough to check the register itself isn't defined, we also need to make sure no overlapping registers are defined either.

This fixes PR26711.

Diff Detail

Repository
rL LLVM

Event Timeline

mkuper updated this revision to Diff 50242.Mar 9 2016, 11:56 PM
mkuper retitled this revision from to [X86] Correctly select registers to pop into for x86_64.
mkuper updated this object.
mkuper added reviewers: rnk, hans.
mkuper added a subscriber: llvm-commits.
aaboud accepted this revision.Mar 10 2016, 6:00 AM
aaboud added a reviewer: aaboud.
aaboud added a subscriber: aaboud.

LGTM

This revision is now accepted and ready to land.Mar 10 2016, 6:00 AM
rnk accepted this revision.Mar 10 2016, 8:36 AM
rnk edited edge metadata.

lgtm

test/CodeGen/X86/pop-stack-cleanup.ll
82 ↗(On Diff #50242)

Add 'LINUX64: retq' so that if more tests are added later the -NOT line will be bound inside this function.

hans accepted this revision.Mar 10 2016, 8:40 AM
hans edited edge metadata.

Thanks for tracking this down!

This revision was automatically updated to reflect the committed changes.