llvm-6502/lib/Transforms/InstCombine
Hal Finkel 64fa501b10 Apply the InstCombine fptrunc sqrt optimization to llvm.sqrt
InstCombine, in visitFPTrunc, applies the following optimization to sqrt calls:

  (fptrunc (sqrt (fpext x))) -> (sqrtf x)

but does not apply the same optimization to llvm.sqrt. This is a problem
because, to enable vectorization, Clang generates llvm.sqrt instead of sqrt in
fast-math mode, and because this optimization is being applied to sqrt and not
applied to llvm.sqrt, sometimes the fast-math code is slower.

This change makes InstCombine apply this optimization to llvm.sqrt as well.

This fixes the specific problem in PR17758, although the same underlying issue
(optimizations applied to libcalls are not applied to intrinsics) exists for
other optimizations in SimplifyLibCalls.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194935 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-16 21:29:08 +00:00
..
CMakeLists.txt Tidy up a bit. No functional change. 2013-04-05 21:20:12 +00:00
InstCombine.h Add instcombine visitor for addrspacecast 2013-11-15 05:45:08 +00:00
InstCombineAddSub.cpp Preserve fast-math flags when folding (fsub x, (fneg y)) to (fadd x, y). 2013-07-30 23:53:17 +00:00
InstCombineAndOrXor.cpp Update the docs to match the function name. 2013-11-13 01:12:01 +00:00
InstCombineCalls.cpp Use type helper functions 2013-09-27 22:18:51 +00:00
InstCombineCasts.cpp Apply the InstCombine fptrunc sqrt optimization to llvm.sqrt 2013-11-16 21:29:08 +00:00
InstCombineCompares.cpp InstCombine: fold (A >> C) == (B >> C) --> (A^B) < (1 << C) for constant Cs. 2013-11-16 16:00:48 +00:00
InstCombineLoadStoreAlloca.cpp InstCombine: Don't allow turning vector-of-pointer loads into vector-of-integer. 2013-09-19 20:59:04 +00:00
InstCombineMulDivRem.cpp InstCombine: Replace manual fast math flag copying with the new IRBuilder RAII helper. 2013-09-30 15:39:59 +00:00
InstCombinePHI.cpp Push analysis passes to InstSimplify when they're around anyways. 2013-09-24 16:37:40 +00:00
InstCombineSelect.cpp InstCombine: Only foldSelectICmpAndOr for integer types 2013-09-27 20:35:39 +00:00
InstCombineShifts.cpp Revert r174152. The shift amount may overflow and in that case this transformation is illegal. 2013-02-01 07:59:33 +00:00
InstCombineSimplifyDemanded.cpp Remove x86_sse42_crc32_64_8 intrinsic. It has no functional difference from x86_sse42_crc32_32_8 and was not mapped to a clang builtin. I'm not even sure why this form of the instruction is even called out explicitly in the docs. Also add AutoUpgrade support to convert it into the other intrinsic with appropriate trunc and zext. 2013-10-15 05:20:47 +00:00
InstCombineVectorOps.cpp Scalarize select vector arguments when extracted. 2013-11-04 20:36:06 +00:00
InstCombineWorklist.h Consistently use dbgs() in debug printing 2013-09-05 19:48:28 +00:00
InstructionCombining.cpp Make gep i8* X, -(ptrtoint Y) transform work with address spaces 2013-10-03 18:15:57 +00:00
LLVMBuild.txt LLVMBuild: Remove trailing newline, which irked me. 2011-12-12 19:48:00 +00:00
Makefile