Page MenuHomePhabricator

X86: Use push-pop for materializing 8-bit immediates for minsize (take 2)
ClosedPublic

Authored by hans on Mar 17 2016, 9:43 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

hans updated this revision to Diff 50946.Mar 17 2016, 9:43 AM
hans retitled this revision from to X86: Use push-pop for materializing 8-bit immediates for minsize (take 2).
hans updated this object.
hans added reviewers: majnemer, DavidKreitzer.
hans added a subscriber: llvm-commits.
majnemer added inline comments.Mar 22 2016, 1:39 PM
test/CodeGen/X86/powi.ll
32–34 ↗(On Diff #50946)

Why did the constant in this test change?

hans added inline comments.Mar 22 2016, 1:52 PM
test/CodeGen/X86/powi.ll
32–34 ↗(On Diff #50946)

Because with the old patch we'd materialize 15 with push/pop, and I figured just tweaking the constant was more clear and less intrusive than updating the expected instructions.

However, in this new patch we conservatively don't use push/pop here because maybe the function could write to the redzone. I'll restore the test.

hans updated this revision to Diff 51336.Mar 22 2016, 1:53 PM

Restore constant in test/CodeGen/X86/powi.ll

DavidKreitzer edited edge metadata.Mar 24 2016, 9:07 AM

FWIW, here is a link to the change set for the original commit of the push/pop optimization: http://reviews.llvm.org/D15549. I just diffed that patch against this new one for the purpose of easier review.

lib/Target/X86/X86InstrInfo.cpp
5369 ↗(On Diff #51336)

This code runs after the red-zone decision has been made, right? Would it be better to capture that decision as part of the MFI and do a more accurate "uses red zone" check here?

If you agree but don't want to make that change now, a FIXME comment would be helpful.

hans added a comment.Mar 24 2016, 11:18 AM

FWIW, here is a link to the change set for the original commit of the push/pop optimization: http://reviews.llvm.org/D15549. I just diffed that patch against this new one for the purpose of easier review.

Oops, it seems like I linked to the wrong one in the description of this patch.

lib/Target/X86/X86InstrInfo.cpp
5369 ↗(On Diff #51336)

I wasn't sure how to do this, but I think I've found a way. I'll upload a new patch.

hans updated this revision to Diff 51573.Mar 24 2016, 11:19 AM
hans updated this object.
hans edited edge metadata.

Accurately check whether the red zone is used or not.

Please fix the >80 char line. Otherwise, LGTM.

lib/Target/X86/X86InstrInfo.cpp
5409 ↗(On Diff #51573)

It looks like this line is too long.

And thanks for making the more precise fix, Hans!

majnemer added inline comments.Mar 24 2016, 4:22 PM
lib/Target/X86/X86InstrCompiler.td
286 ↗(On Diff #51573)

Why isn't this NotWin64WithoutFP ?

hans marked an inline comment as done.Mar 24 2016, 6:09 PM
hans added inline comments.
lib/Target/X86/X86InstrCompiler.td
286 ↗(On Diff #51573)

Looks like I forgot to add it. I'll fix this and add a test when committing.

This revision was automatically updated to reflect the committed changes.