This is an archive of the discontinued LLVM Phabricator instance.

Preserve BasePtr for LEA64_32r
ClosedPublic

Authored by hjl.tools on Aug 16 2016, 12:10 PM.

Details

Summary

When replacing FrameIndex with BasePtr, we must preserve BasePtr for
LEA64_32r since BasePtr is used later for stack adjustment if it is
the same as StackPtr.

Diff Detail

Repository
rL LLVM

Event Timeline

hjl.tools updated this revision to Diff 68237.Aug 16 2016, 12:10 PM
hjl.tools retitled this revision from to Preserve BasePtr for LEA64_32r .
hjl.tools updated this object.
hjl.tools added a reviewer: llvm-commits.
hjl.tools set the repository for this revision to rL LLVM.
hjl.tools added subscribers: DavidKreitzer, mkuper, zansari.
mkuper added inline comments.Aug 16 2016, 12:26 PM
lib/Target/X86/X86RegisterInfo.cpp
638 ↗(On Diff #68237)

Maybe something like:

unsigned MachineBasePtr = BasePtr;
if (Opc == X86::LEA64_32r && X86::GR32RegClass.contains(BasePtr))
  MachineBasePtr = getX86SubSuperRegister(BasePtr, 64);

?

645 ↗(On Diff #68237)

As long as you're touching this, can you fix this comment to make sense?

test/CodeGen/X86/x32-movtopush64.ll
1 ↗(On Diff #68237)

You shouldn't need the -O2, I think.

hjl.tools updated this revision to Diff 68246.Aug 16 2016, 1:01 PM

Updated with comments from Michael.

mkuper accepted this revision.Aug 16 2016, 1:45 PM
mkuper added a reviewer: mkuper.

LGTM

This revision is now accepted and ready to land.Aug 16 2016, 1:45 PM

Looks like patch was not committed.

This revision was automatically updated to reflect the committed changes.