This is an archive of the discontinued LLVM Phabricator instance.

Annotate `llvm.eh.sjlj.setjmp` as `returns_twice`
Needs ReviewPublic

Authored by xtkoba on Sep 3 2021, 10:40 AM.

Details

Reviewers
jdoerfert
Summary

In LLVM, some optimizations are disabled for functions that return twice. For instance, register coalescing in those functions is disabled by D77767. Currently, this does not apply to __builtin_setjmp, because the intrinsic function llvm.eh.sjlj.setjmp is not annotated as returns_twice.

In the proposed change, we annotate llvm.eh.sjlj.setjmp as returns_twice. This fixes PR50234.

Diff Detail

Event Timeline

xtkoba requested review of this revision.Sep 3 2021, 10:40 AM
xtkoba created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptSep 3 2021, 10:40 AM
xtkoba updated this revision to Diff 370642.Sep 3 2021, 12:18 PM
  • Tests revised.
  • Reformatted.
xtkoba added a comment.Sep 3 2021, 9:14 PM

It has been revealed that this also fixes PR51729.

xtkoba updated this revision to Diff 370725.Sep 4 2021, 3:25 AM

Diff context extended

dim added a subscriber: dim.Sep 5 2021, 10:36 AM

I'm not a reviewer, but this looks good to me. (At first I thought that the required tablegen additions were missing, but they were at the end of the list of files so I missed them :) )

LG, but I'd prefer an explicit IR test. There should be some, if not add a new one to verify we add returns twice properly.