This is an archive of the discontinued LLVM Phabricator instance.

Expose CastInst::getCastOpcode in C API

Authored by jackoalan on Nov 15 2020, 8:26 PM.



Users of LLVMBuildCast currently need to implement their own logic to determine the best cast opcode. In cases where the source value and destination type is known, LLVM already has the CastInst::getCastOpcode function to determine the opcode based on type combinations.

This simply exposes the existing function to users of the C API.

Diff Detail

Event Timeline

jackoalan created this revision.Nov 15 2020, 8:26 PM
jackoalan requested review of this revision.Nov 15 2020, 8:26 PM

It would be good to have a test case for this.

jackoalan updated this revision to Diff 380116.Oct 15 2021, 4:06 PM

Add unit test

deadalnix accepted this revision.Apr 30 2022, 3:02 PM
This revision is now accepted and ready to land.Apr 30 2022, 3:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 30 2022, 3:02 PM
This revision was automatically updated to reflect the committed changes.