[strictfp] Replace dangling strictfp attrs with nobuiltin

In preparation for a patch that will enforce new rules for the usage of
the strictfp attribute, this patch introduces auto-upgrade behavior that
will replace the strictfp attribute on callsites with nobuiltin if the
enclosing function declaration doesn't also have the strictfp attribute.

This auto-upgrade isn't being performed on .ll files because that would
prevent us from writing a test for the forthcoming verifier behavior.

Differential Revision: https://reviews.llvm.org/D70096
This commit is contained in:
Kevin P. Neal
2020-05-14 11:57:19 -07:00
parent 8799ebbc1f
commit 07f3351284
6 changed files with 117 additions and 4 deletions

View File

@@ -3002,6 +3002,7 @@ Error BitcodeReader::globalCleanup() {
return error("Malformed global initializer set");
// Look for intrinsic functions which need to be upgraded at some point
// and functions that need to have their function attributes upgraded.
for (Function &F : *TheModule) {
MDLoader->upgradeDebugIntrinsics(F);
Function *NewFn;
@@ -3012,6 +3013,8 @@ Error BitcodeReader::globalCleanup() {
// loaded in the same LLVMContext (LTO scenario). In this case we should
// remangle intrinsics names as well.
RemangledIntrinsics[&F] = Remangled.getValue();
// Look for functions that rely on old function attribute behavior.
UpgradeFunctionAttributes(F);
}
// Look for global variables which need to be renamed.
@@ -5376,6 +5379,9 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
}
}
// Look for functions that rely on old function attribute behavior.
UpgradeFunctionAttributes(*F);
// Bring in any functions that this function forward-referenced via
// blockaddresses.
return materializeForwardReferencedFunctions();