This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Do not introduce bitcasts for swifterror arguments.
ClosedPublic

Authored by fhahn on Oct 27 2020, 11:56 AM.

Details

Summary

The following constraints hold for swifterror values:

A swifterror value (either the parameter or the alloca) can only
be loaded and stored from, or used as a swifterror argument.

This patch updates instcombine to not try to convert a bitcast of a
function into a bitcast of a swifterror argument.

Diff Detail

Event Timeline

fhahn created this revision.Oct 27 2020, 11:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 27 2020, 11:56 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
fhahn requested review of this revision.Oct 27 2020, 11:56 AM

FWIW this patch is consistent with what i have seen; although i'm not faimiliar with that function so i can't say whether or not that is the right fix.

vsk added a subscriber: vsk.Oct 27 2020, 12:07 PM
vsk added inline comments.
llvm/test/Transforms/InstCombine/swifterror-argument-bitcast-fold.ll
3

Just a drive-by question/comment -- is a check line needed here? I assumed FileCheck complains if it doesn't find one.

fhahn added inline comments.Oct 27 2020, 12:08 PM
llvm/test/Transforms/InstCombine/swifterror-argument-bitcast-fold.ll
3

arg, it should have added check lines.......... Will update

LGTM. Untyped pointers can't come soon enough.

fhahn updated this revision to Diff 301083.Oct 27 2020, 12:29 PM

Add proper RUN & CHECK lines to test.

vsk added a comment.Oct 27 2020, 3:02 PM

Test changes look reasonable to me!

fhahn added a comment.Oct 28 2020, 2:03 PM

Thanks for taking a look! Anyone willing to mark as approved in Phabricator?

rjmccall accepted this revision.Oct 28 2020, 2:39 PM
This revision is now accepted and ready to land.Oct 28 2020, 2:39 PM
This revision was landed with ongoing or failed builds.Oct 28 2020, 2:53 PM
This revision was automatically updated to reflect the committed changes.
fhahn added a comment.Oct 28 2020, 2:53 PM

Thanks everyone!