diff options
author | Kevin P. Neal <kevin.neal@sas.com> | 2024-03-29 14:54:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-29 14:54:51 -0400 |
commit | fe893c93b7bd3b3c436b97383db21e08c9ec4b25 (patch) | |
tree | bc0c5e3a10f3686f9d08291617a4de512449808e /llvm/lib/CodeGen/AtomicExpandPass.cpp | |
parent | 2684a0966d5c84071c811c68ec25e41a0beb26f4 (diff) | |
download | llvm-fe893c93b7bd3b3c436b97383db21e08c9ec4b25.zip llvm-fe893c93b7bd3b3c436b97383db21e08c9ec4b25.tar.gz llvm-fe893c93b7bd3b3c436b97383db21e08c9ec4b25.tar.bz2 |
[FPEnv][AtomicExpand] Correct strictfp attribute handling in AtomicExpandPass (#87082)
The AtomicExpand pass was lowering function calls with the strictfp
attribute to sequences that included function calls incorrectly lacking
the attribute. This patch corrects that.
The pass now also emits the correct constrained fp call instead of
normal FP instructions when in a function with the strictfp attribute.
Test changes verified with D146845.
Diffstat (limited to 'llvm/lib/CodeGen/AtomicExpandPass.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AtomicExpandPass.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AtomicExpandPass.cpp b/llvm/lib/CodeGen/AtomicExpandPass.cpp index 894285a..d5db79d 100644 --- a/llvm/lib/CodeGen/AtomicExpandPass.cpp +++ b/llvm/lib/CodeGen/AtomicExpandPass.cpp @@ -135,10 +135,13 @@ public: // IRBuilder to be used for replacement atomic instructions. struct ReplacementIRBuilder : IRBuilder<InstSimplifyFolder> { // Preserves the DebugLoc from I, and preserves still valid metadata. + // Enable StrictFP builder mode when appropriate. explicit ReplacementIRBuilder(Instruction *I, const DataLayout &DL) : IRBuilder(I->getContext(), DL) { SetInsertPoint(I); this->CollectMetadataToCopy(I, {LLVMContext::MD_pcsections}); + if (BB->getParent()->getAttributes().hasFnAttr(Attribute::StrictFP)) + this->setIsFPConstrained(true); } }; |