Page MenuHomePhabricator

Expose CastInst::getCastOpcode in C API
Needs ReviewPublic

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

Unit TestsFailed

400 mslinux > HWAddressSanitizer-x86_64.TestCases::sizes.cpp
Script: -- : 'RUN: at line 3'; /mnt/disks/ssd0/agent/llvm-project/build/./bin/clang --driver-mode=g++ -m64 -gline-tables-only -fsanitize=hwaddress -fuse-ld=lld -mcmodel=large -mllvm -hwasan-globals -mllvm -hwasan-use-short-granules -mllvm -hwasan-instrument-landing-pads=0 -mllvm -hwasan-instrument-personality-functions /mnt/disks/ssd0/agent/llvm-project/compiler-rt/test/hwasan/TestCases/sizes.cpp -nostdlib++ -lstdc++ -o /mnt/disks/ssd0/agent/llvm-project/build/projects/compiler-rt/test/hwasan/X86_64/TestCases/Output/sizes.cpp.tmp
60 mslinux > SanitizerCommon-Unit._/Sanitizer-x86_64-Test::SanitizerCommon.StackDepotPrint
Note: Google Test filter = SanitizerCommon.StackDepotPrint [==========] Running 1 test from 1 test case. [----------] Global test environment set-up.

Event Timeline

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