From ecbe4d1e360e25c0634a3a62fbd01e8df5bb0c1b Mon Sep 17 00:00:00 2001 From: John Brawn Date: Wed, 4 Dec 2024 10:53:04 +0000 Subject: [IR] Allow fast math flags on fptrunc and fpext (#115894) This consists of: * Make these instructions part of FPMathOperator. * Adjust bitcode/ir readers/writers to expect fast math flags on these instructions. * Make IRBuilder set the fast math flags on these instructions. * Update langref and release notes. * Update a bunch of tests. Some of these are due to InstCombineCasts incorrectly adding fast math flags to fptrunc, which will be fixed in a later patch. --- llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp') diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index a585a24..85c6fad 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -5197,6 +5197,11 @@ Error BitcodeReader::parseFunctionBody(Function *F) { if (Record[OpNum] & (1 << bitc::TIO_NO_SIGNED_WRAP)) cast(I)->setHasNoSignedWrap(true); } + if (isa(I)) { + FastMathFlags FMF = getDecodedFastMathFlags(Record[OpNum]); + if (FMF.any()) + I->setFastMathFlags(FMF); + } } InstructionList.push_back(I); -- cgit v1.1