Page MenuHomePhabricator

[Builtins] Synchronize the definition of fma/fmaf/fmal in Builtins.def with the implementation in CGBuiltins.cpp

Authored by craig.topper on Mar 13 2017, 4:51 PM.



The fma libcalls are defined in Builtins.def using the 'e' attribute that says that its only const if -fno-math-errno. It was apparently marked this way because that's what the posix spec says. This determines whether the call gets marked as const or not in SemaDecl.cpp. But in CGBuiltins.cpp we are blindly emitting an intrinsic no matter whether the call is const or not.

This patch changes Builtins.def to match the current CGBuiltins behavior and updates CGBuiltins to check if the function is const. So if anyone ever changes Builtins.def in the future it will do the right thing.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 13 2017, 4:51 PM
craig.topper abandoned this revision.May 12 2017, 11:28 AM