[PATCH] D99439: Update @llvm.powi to handle different int sizes for the exponent
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 13 12:06:46 PDT 2021
efriedma added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp:581
RTLIB::POWI_F128,
RTLIB::POWI_PPCF128);
if (!TLI.getLibcallName(LC)) {
----------------
bjope wrote:
> efriedma wrote:
> > This is missing a diagnostic for the exponent. We don't want to silently miscompile if someone uses an exponent that isn't supported by the target.
> Not sure exactly what you suggest. Is that a general comment for all places in SelectionDAG where we may emit calls to RTLIB::POWI or what makes this SoftenFloatRes special?
>
> If we end up using mismatching types in the call, wouldn't that being detected as ICE elsewhere? Only reason I made changes to this function in the first place was due to the historical assert above regarding the type of the exponent in FPOWI. Maybe I should just drop that assert instead? This is the only place where that is checked, but I figure that the SoftenFloatRes legalization is just one out of many places where FPOWI is legalized and lowered into libcalls to RTLIB::POWI.
It's a general issue with emitting calls to RTLIB::POWI; the second parameter to the call has to have type "int", to match the definition in libgcc/compiler-rt. I guess there are a few other places that also emit calls to these functions.
> If we end up using mismatching types in the call, wouldn't that being detected as ICE elsewhere?
In SelectionDAG, function/pointer types don't exist; the callee of a function call is just a integer. So we'd never detect mismatched types; we'd just silently emit a call using the wrong calling convention.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99439/new/
https://reviews.llvm.org/D99439
More information about the cfe-commits
mailing list