diff options
| author | Melanie Blower <melanie.blower@intel.com> | 2019-12-04 12:23:46 -0800 |
|---|---|---|
| committer | Melanie Blower <melanie.blower@intel.com> | 2019-12-05 03:48:04 -0800 |
| commit | 7f9b5138470db1dc58f3bc05631284c653c9ed7a (patch) | |
| tree | 6df6dcd5ce5f7d56fcef6e72ab2c3f287bce860e /llvm | |
| parent | c16f0b18c13e88fedaa510bc2442bb693a6230c8 (diff) | |
| download | bcm5719-llvm-7f9b5138470db1dc58f3bc05631284c653c9ed7a.tar.gz bcm5719-llvm-7f9b5138470db1dc58f3bc05631284c653c9ed7a.zip | |
Reapply af57dbf12e54 "Add support for options -frounding-math, ftrapping-math, -ffp-model=, and -ffp-exception-behavior="
Patch was reverted because https://bugs.llvm.org/show_bug.cgi?id=44048
The original patch is modified to set the strictfp IR attribute
explicitly in CodeGen instead of as a side effect of IRBuilder.
In the 2nd attempt to reapply there was a windows lit test fail, the
tests were fixed to use wildcard matching.
Differential Revision: https://reviews.llvm.org/D62731
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/IR/IRBuilder.h | 1 | ||||
| -rw-r--r-- | llvm/include/llvm/Target/TargetOptions.h | 2 | ||||
| -rw-r--r-- | llvm/unittests/IR/IRBuilderTest.cpp | 5 |
3 files changed, 5 insertions, 3 deletions
diff --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h index 2d9c72108d3..24d39c2bc52 100644 --- a/llvm/include/llvm/IR/IRBuilder.h +++ b/llvm/include/llvm/IR/IRBuilder.h @@ -265,7 +265,6 @@ public: void setConstrainedFPCallAttr(CallInst *I) { if (!I->hasFnAttr(Attribute::StrictFP)) I->addAttribute(AttributeList::FunctionIndex, Attribute::StrictFP); - setConstrainedFPFunctionAttr(); } //===--------------------------------------------------------------------===// diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h index c395e5bcecf..d1db4eceabb 100644 --- a/llvm/include/llvm/Target/TargetOptions.h +++ b/llvm/include/llvm/Target/TargetOptions.h @@ -107,7 +107,7 @@ namespace llvm { public: TargetOptions() : PrintMachineCode(false), UnsafeFPMath(false), NoInfsFPMath(false), - NoNaNsFPMath(false), NoTrappingFPMath(false), + NoNaNsFPMath(false), NoTrappingFPMath(true), NoSignedZerosFPMath(false), HonorSignDependentRoundingFPMathOption(false), NoZerosInBSS(false), GuaranteedTailCallOpt(false), StackSymbolOrdering(true), diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp index d7712fda127..814da64c785 100644 --- a/llvm/unittests/IR/IRBuilderTest.cpp +++ b/llvm/unittests/IR/IRBuilderTest.cpp @@ -183,6 +183,8 @@ TEST_F(IRBuilderTest, ConstrainedFP) { // See if we get constrained intrinsics instead of non-constrained // instructions. Builder.setIsFPConstrained(true); + auto Parent = BB->getParent(); + Parent->addFnAttr(Attribute::StrictFP); V = Builder.CreateFAdd(V, V); ASSERT_TRUE(isa<IntrinsicInst>(V)); @@ -233,7 +235,8 @@ TEST_F(IRBuilderTest, ConstrainedFP) { AttributeSet CallAttrs = II->getAttributes().getFnAttributes(); EXPECT_EQ(CallAttrs.hasAttribute(Attribute::StrictFP), true); - // Verify attributes on the containing function are created automatically. + // Verify attributes on the containing function are created when requested. + Builder.setConstrainedFPFunctionAttr(); AttributeList Attrs = BB->getParent()->getAttributes(); AttributeSet FnAttrs = Attrs.getFnAttributes(); EXPECT_EQ(FnAttrs.hasAttribute(Attribute::StrictFP), true); |

