]> granicus.if.org Git - llvm/commit
[IR] allow fast-math-flags on phi of FP values (2nd try)
authorSanjay Patel <spatel@rotateright.com>
Wed, 25 Sep 2019 14:35:02 +0000 (14:35 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 25 Sep 2019 14:35:02 +0000 (14:35 +0000)
commitb7acbfc2f3af2b86628181e5b4ac1631caf54b8c
tree4fd7ec3d2d36238bd15a09f507b56ace2159a99c
parent3f73a2b50d041c539eac1f4a1df790d7a687a46d
[IR] allow fast-math-flags on phi of FP values (2nd try)

The changes here are based on the corresponding diffs for allowing FMF on 'select':
D61917 <https://reviews.llvm.org/D61917>

As discussed there, we want to have fast-math-flags be a property of an FP value
because the alternative (having them on things like fcmp) leads to logical
inconsistency such as:
https://bugs.llvm.org/show_bug.cgi?id=38086

The earlier patch for select made almost no practical difference because most
unoptimized conditional code begins life as a phi (based on what I see in clang).
Similarly, I don't expect this patch to do much on its own either because
SimplifyCFG promptly drops the flags when converting to select on a minimal
example like:
https://bugs.llvm.org/show_bug.cgi?id=39535

But once we have this plumbing in place, we should be able to wire up the FMF
propagation and start solving cases like that.

The change to RecurrenceDescriptor::AddReductionVar() is required to prevent a
regression in a LoopVectorize test. We are intersecting the FMF of any
FPMathOperator there, so if a phi is not properly annotated, new math
instructions may not be either. Once we fix the propagation in SimplifyCFG, it
may be safe to remove that hack.

Differential Revision: https://reviews.llvm.org/D67564

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@372878 91177308-0d34-0410-b5e6-96231b3b80d8
docs/LangRef.rst
include/llvm/IR/IRBuilder.h
include/llvm/IR/Operator.h
lib/Analysis/IVDescriptors.cpp
lib/AsmParser/LLParser.cpp
lib/Bitcode/Reader/BitcodeReader.cpp
lib/Bitcode/Writer/BitcodeWriter.cpp
test/Bitcode/compatibility.ll
unittests/IR/InstructionsTest.cpp