[PATCH] D39481: [CodeGen] fix const-ness of builtin equivalents of <math.h> and <complex.h> functions that might set errno
Craig Topper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 2 10:10:15 PDT 2017
craig.topper added a comment.
There's an oddity with fma. The version without __builtin has 'e' already
LIBBUILTIN(fma, "dddd", "fne", "math.h", ALL_LANGUAGES)
LIBBUILTIN(fmaf, "ffff", "fne", "math.h", ALL_LANGUAGES)
LIBBUILTIN(fmal, "LdLdLdLd", "fne", "math.h", ALL_LANGUAGES)
But we don't check the const attribute in CGBuiltin.cpp before converting it to an intrinsic
case Builtin::BIfma:
case Builtin::BIfmaf:
case Builtin::BIfmal:
case Builtin::BI__builtin_fma:
case Builtin::BI__builtin_fmaf:
case Builtin::BI__builtin_fmal: {
// Rewrite fma to intrinsic.
Value *FirstArg = EmitScalarExpr(E->getArg(0));
llvm::Type *ArgType = FirstArg->getType();
Value *F = CGM.getIntrinsic(Intrinsic::fma, ArgType);
return RValue::get(
Builder.CreateCall(F, {FirstArg, EmitScalarExpr(E->getArg(1)),
EmitScalarExpr(E->getArg(2))}));
}
https://reviews.llvm.org/D39481
More information about the cfe-commits
mailing list