[PATCH] D34163: Add strictfp attribute to prevent unwanted optimizations of libm calls

Andy Kaylor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 13:07:21 PDT 2017


andrew.w.kaylor created this revision.
Herald added a subscriber: javed.absar.

In preparation for supporting the  STDC FENV_ACCESS pragma (and related other pragmas), we need a way to prevent optimizations to libm function calls.  To accomplish this, I am adding a new function attribute, strictfp, which tells the optimizer to handle these calls specially.  This attribute should behave similarly to the nobuiltin attribute, but it isn't quite as restrictive.  In particular, it allows optimizations that would be blocked by nobuiltin as long as the optimization is not related to FP semantics.

Since we don't expect (or want) the front end to maintain knowledge about which functions the optimizer recognizes as LibFuncs, the expectation is that the front end will attach the strictfp attribute to all function calls within any scope where FENV_ACCESS is enabled.  This should have no effect for functions that are not FP-related.


Repository:
  rL LLVM

https://reviews.llvm.org/D34163

Files:
  docs/LangRef.rst
  include/llvm/Bitcode/LLVMBitCodes.h
  include/llvm/IR/Attributes.td
  include/llvm/IR/CallSite.h
  include/llvm/IR/Instructions.h
  include/llvm/Transforms/Utils/SimplifyLibCalls.h
  lib/Analysis/ConstantFolding.cpp
  lib/AsmParser/LLLexer.cpp
  lib/AsmParser/LLParser.cpp
  lib/AsmParser/LLToken.h
  lib/Bitcode/Reader/BitcodeReader.cpp
  lib/Bitcode/Writer/BitcodeWriter.cpp
  lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  lib/IR/Attributes.cpp
  lib/IR/Verifier.cpp
  lib/Transforms/IPO/ForceFunctionAttrs.cpp
  lib/Transforms/Utils/SimplifyLibCalls.cpp
  test/Bitcode/compatibility.ll
  test/Transforms/DCE/calls-errno.ll
  test/Transforms/InstCombine/constant-fold-libfunc.ll
  test/Transforms/InstCombine/memcpy-1.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34163.102387.patch
Type: text/x-patch
Size: 20583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170613/d3e69891/attachment.bin>


More information about the llvm-commits mailing list