This is an archive of the discontinued LLVM Phabricator instance.

[X86] Fix X32 indirect call generation
ClosedPublic

Authored by hvdijk on Oct 29 2021, 5:46 PM.

Details

Summary

The check for whether a zero extension was needed was subtly wrong and saw a value that was already 64 bits, so did not extend.

Fixes PR52357.

Diff Detail

Event Timeline

hvdijk created this revision.Oct 29 2021, 5:46 PM
hvdijk requested review of this revision.Oct 29 2021, 5:46 PM
hvdijk retitled this revision from [X86] Fix X32 tail call generation to [X86] Fix X32 indirect call generation.Oct 29 2021, 5:57 PM
hvdijk updated this revision to Diff 383544.Oct 29 2021, 6:04 PM

Hm, I should have taken tail call out of the description and test name, this is not limited to tail calls. Then, removing -tailcallopt from the test, it does happen to use a tail call, but that's not the point of the test.

RKSimon added inline comments.Nov 1 2021, 3:12 AM
llvm/test/CodeGen/X86/call-structfp.ll
5

(style) Please can you include a reference to PR52357 somewhere for any future triage/forensics - renaming the method @PR52357 or add a comment, it helps reduce git blame trawling.

hvdijk updated this revision to Diff 384222.Nov 2 2021, 2:02 PM

Renamed function in test.

hvdijk marked an inline comment as done.Nov 2 2021, 2:02 PM
hvdijk added inline comments.
llvm/test/CodeGen/X86/call-structfp.ll
5

Sure, done.

hvdijk marked an inline comment as done.Nov 2 2021, 2:02 PM
RKSimon accepted this revision.Nov 3 2021, 2:52 AM

LGTM

This revision is now accepted and ready to land.Nov 3 2021, 2:52 AM
This revision was automatically updated to reflect the committed changes.
MaskRay added inline comments.Nov 3 2021, 9:50 AM
llvm/test/CodeGen/X86/call-structfp.ll
2

Consider moving this into x32-function_pointer-*.ll

hvdijk added inline comments.Nov 3 2021, 10:02 AM
llvm/test/CodeGen/X86/call-structfp.ll
2

Sure. This comment was after the push, so it'd have to be a new separate change, but I could rename the test to x32-function_pointer-4.ll and add a -fast-isel RUN line like the other x32-function_pointer-*.ll tests if you like.

MaskRay added inline comments.Nov 3 2021, 10:23 AM
llvm/test/CodeGen/X86/call-structfp.ll
2

(When I pushed the comment with "Accept", the revision had been closed.)

May not need a separate file. May just place several cases into one file. It is sometimes easier for readers to follow when placed in one file testing multiple variants.

hvdijk added inline comments.Nov 3 2021, 11:42 AM
llvm/test/CodeGen/X86/call-structfp.ll
2

x32-function_pointer-3.ll is closest to what's tested here since it also involves a function pointer in a struct, so it could be made part of that. I have no strong opinions on whether it should be, but no problem with it. However, that test was not created using update_llc_test_checks.py, and this one is, so one or the other would have to change if they were to be in the same file. This is not difficult, but also not trivial, it requires a little bit of consideration to figure out which way works best; I will take a look at that later.

hvdijk added inline comments.
llvm/test/CodeGen/X86/call-structfp.ll
2

Created D113157 for this.