This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine][msp430] Pre-commit test case for @llvm.powi and 16-bit ints
ClosedPublic

Authored by bjope on May 21 2021, 6:31 AM.

Details

Summary

This is a pre-commit of a test case D99439 which is a patch that
updates @llvm.powi to handle different int sizes for the exponent.

Problem is that @llvm.powi is used as an IR construct that maps
to RT libcalls to __powi* functions, and those lib functions depend
on sizeof(int) to use correct type for the exponent.

The test cases show that we use i32 for the powi expenent, which
later would result in wrong type being used in libcalls (miscompile).

But there are also a couple of the negative test cases that show
that we rewrite into using powi when having a uitofp conversion
from i16, which would be wrong when doing the libcall as an
"unsigned int" isn't guaranteed to fit inside the "int" argument
in the called libcall function.

Diff Detail

Event Timeline

bjope requested review of this revision.May 21 2021, 6:31 AM
bjope created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 21 2021, 6:31 AM
bjope updated this revision to Diff 347512.May 24 2021, 2:48 PM

Rebased on top of D103050.

This revision was not accepted when it landed; it landed in state Needs Review.Jun 2 2021, 2:42 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.