Page MenuHomePhabricator

[X86] Initial cleanups on the FixupLEAs pass. Separate Atom LEA creation from other LEA optimizations.

Authored by craig.topper on Apr 22 2019, 10:53 PM.



This removes some of the class variables. Merge basic block processing into
runOnMachineFunction to keep the flags local.

Pass MachineBasicBlock around instead of an iterator. We can get the iterator in
the few places that need it. Allows a range-based outer for loop.

Separate the Atom optimization from the rest of the optimizations. This allows
fixupIncDec to create INC/DEC and still allow Atom to turn it back into LEA
when profitable by its heuristics.

I'd like to improve fixupIncDec to turn LEAs into ADD any time the base or index
register is equal to the destination register. This is profitable regardless of
the various slow flags. But again we would want Atom to be able to undo that.

Diff Detail


Event Timeline

craig.topper created this revision.Apr 22 2019, 10:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 22 2019, 10:53 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
craig.topper marked an inline comment as done.Apr 23 2019, 12:09 PM
craig.topper added inline comments.
40 ↗(On Diff #196183)

Forgot to mention. This change is specifically because the OptIncDec code was creating an INC here and preventing Atom from visiting it due to the continue.

RKSimon added inline comments.Apr 23 2019, 1:17 PM
40 ↗(On Diff #196183)

Please can you regenerate this against trunk?

Rebase after precommitting test autogeneration.

This revision is now accepted and ready to land.Apr 30 2019, 4:28 AM
This revision was automatically updated to reflect the committed changes.