[PATCH] D61917: [IR] allow fast-math-flags on select of FP values

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 13:51:56 PDT 2019


spatel created this revision.
spatel added reviewers: efriedma, arsenm, cameron.mcinally, hfinkel, jmolloy.
Herald added subscribers: llvm-commits, hiraditya, wdng, mcrosier.
Herald added a project: LLVM.

This is a minimal start to correcting a problem most directly discussed in PR38086:
https://bugs.llvm.org/show_bug.cgi?id=38086

We have been hacking around a limitation for FP select patterns by using the fast-math-flags on the condition of the select rather than the select itself. 
This patch just allows FMF to appear with the 'select' opcode. No changes are needed to "FPMathOperator" because it already includes select-of-FP because that definition is based on the return value type.

Once we have this ability, we can start correcting and adding IR transforms to use the FMF on a 'select' instruction. The instcombine and vectorizer test diffs only show that the IRBuilder change is behaving as expected by applying an FMF guard value to 'select'.

For reference:
rL241901 <https://reviews.llvm.org/rL241901> - allowed FMF with fcmp
rL255555 <https://reviews.llvm.org/rL255555> - allowed FMF with FP calls


https://reviews.llvm.org/D61917

Files:
  llvm/docs/LangRef.rst
  llvm/include/llvm/IR/IRBuilder.h
  llvm/lib/AsmParser/LLParser.cpp
  llvm/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
  llvm/test/Bitcode/compatibility.ll
  llvm/test/CodeGen/Generic/expand-experimental-reductions.ll
  llvm/test/Transforms/InstCombine/fast-math.ll
  llvm/test/Transforms/InstCombine/pow-sqrt.ll
  llvm/test/Transforms/LoopVectorize/float-minmax-instruction-flag.ll
  llvm/test/Transforms/LoopVectorize/minmax_reduction.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61917.199506.patch
Type: text/x-patch
Size: 19103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190514/445edf61/attachment.bin>


More information about the llvm-commits mailing list