This is an archive of the discontinued LLVM Phabricator instance.

[CodeGenPrepare] Also skip lifetime.end intrinsic when check return block in dupRetToEnableTailCallOpts
ClosedPublic

Authored by junparser on Jan 25 2021, 11:33 PM.

Details

Summary

As we find in many real workloads that there are maybe some lifetime.end intrinsics existing in return block, so it is better to skip lifetime.end intrinsic as well. This patch just do such thing.

TestPlan: check-llvm

Diff Detail

Event Timeline

junparser created this revision.Jan 25 2021, 11:33 PM
junparser requested review of this revision.Jan 25 2021, 11:33 PM

Update testcase.

Hi,
This transformation is basically removing lifetime.end, is my understanding right?

In terms of correctness, this is fine IMO because removing lifetime.end makes the program more defined.
It is also syntactically fine to have an unmatched lifetime.start because LLVM already removes unreachable code that may contain lifetime.end.

Hi,
This transformation is basically removing lifetime.end, is my understanding right?

Yes, It remove lifetime.end in the new duplicated return block.

In terms of correctness, this is fine IMO because removing lifetime.end makes the program more defined.
It is also syntactically fine to have an unmatched lifetime.start because LLVM already removes unreachable code that may contain lifetime.end.

Yes, you are right, also IMO lifetime.end does not have any effect in return block.

junparser added a comment.EditedJan 28 2021, 6:44 PM

@xbolva00 @Carrot Would you take a look at this patch? Since I have seen you also deal with tailcall in D76539.

xbolva00 accepted this revision.Jan 29 2021, 4:42 AM
This revision is now accepted and ready to land.Jan 29 2021, 4:42 AM