llvm/test/Transforms
Sanjay Patel 0056820a48 Make the sqrt intrinsic return undef for a negative input.
As discussed here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140609/220598.html

And again here:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/077168.html

The sqrt of a negative number when using the llvm intrinsic is undefined. 
We should return undef rather than 0.0 to match the definition in the LLVM IR lang ref.

This change should not affect any code that isn't using "no-nans-fp-math"; 
ie, no-nans is a requirement for generating the llvm intrinsic in place of a sqrt function call.

Unfortunately, the behavior introduced by this patch will not match current gcc, xlc, icc, and 
possibly other compilers. The current clang/llvm behavior of returning 0.0 doesn't either. 
We knowingly approve of this difference with the other compilers in an attempt to flag code 
that is invoking undefined behavior.

A front-end warning should also try to convince the user that the program will fail:
http://llvm.org/bugs/show_bug.cgi?id=21093

Differential Revision: http://reviews.llvm.org/D5527



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218803 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 20:36:33 +00:00
..
ADCE
AddDiscriminators Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
AlignmentFromAssumptions [AlignmentFromAssumptions] Don't crash just because the target is 32-bit 2014-09-11 08:40:17 +00:00
ArgumentPromotion Don't promote byval pointer arguments when padding matters 2014-08-28 22:42:00 +00:00
AtomicExpand/ARM Use target-dependent emitLeading/TrailingFence instead of the target-independent insertLeading/TrailingFence (in AtomicExpandPass) 2014-09-03 21:01:03 +00:00
BBVectorize Reduce verbiage of lit.local.cfg files 2014-06-09 22:42:55 +00:00
BranchFolding
CodeExtractor
CodeGenPrepare CodeGenPrep: fall back to MVT::Other if instruction's type isn't an EVT. 2014-07-29 10:20:22 +00:00
ConstantHoisting [ConstantHoisting][X86] Improve the cost model for small constants with large types (i64 and above). 2014-06-10 00:32:29 +00:00
ConstantMerge Remove the linker_private and linker_private_weak linkages. 2014-03-13 23:18:37 +00:00
ConstProp Fix a bug around truncating vector in const prop. 2014-08-21 02:12:35 +00:00
CorrelatedValuePropagation
DeadArgElim Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
DeadStoreElimination Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
DebugIR
EarlyCSE
FunctionAttrs [optnone] Make the optnone attribute effective at suppressing function 2014-08-13 10:49:33 +00:00
GCOVProfiling Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
GlobalDCE Remove dangling initializers in GlobalDCE 2014-08-25 17:51:14 +00:00
GlobalOpt Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
GVN Relax the constraint more in MemoryDependencyAnalysis.cpp 2014-08-29 20:32:58 +00:00
IndVarSimplify [IndVarSimplify] Widen loop unsigned compares. 2014-09-30 03:17:42 +00:00
Inline Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
InstCombine Make the sqrt intrinsic return undef for a negative input. 2014-10-01 20:36:33 +00:00
InstMerge MergedLoadStoreMotion pass 2014-07-18 19:13:09 +00:00
InstSimplify InstSimplify: Don't allow (x srem y) urem y -> x srem y 2014-09-17 04:16:35 +00:00
Internalize Use "weak alias" instead of "alias weak" 2014-07-30 22:51:54 +00:00
IPConstantProp No need for those tests to go thru llvm-as and/or llvm-dis. 2014-05-27 22:03:28 +00:00
JumpThreading Make use of @llvm.assume from LazyValueInfo 2014-09-07 20:29:59 +00:00
LCSSA
LICM Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
LoadCombine Add LoadCombine pass. 2014-05-29 01:55:07 +00:00
LoopDeletion
LoopIdiom Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
LoopReroll
LoopRotate Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
LoopSimplify FileCheckize. NFC. 2014-09-12 17:55:16 +00:00
LoopStrengthReduce Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
LoopUnroll Use a loop to simplify the runtime unrolling prologue. 2014-09-29 11:15:00 +00:00
LoopUnswitch
LoopVectorize Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
LowerAtomic IR: add "cmpxchg weak" variant to support permitted failure. 2014-06-13 14:24:07 +00:00
LowerExpectIntrinsic
LowerInvoke Remove LowerInvoke's obsolete "-enable-correct-eh-support" option 2014-03-20 19:54:47 +00:00
LowerSwitch Added test for commit r212802 that was missing 2014-07-11 10:36:00 +00:00
Mem2Reg Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
MemCpyOpt Fix a really bad miscompile introduced in r216865 - the else-if logic 2014-09-01 10:09:18 +00:00
MergeFunc Fix crash when looking up the addrspace of GEPs with vector types 2014-09-02 18:47:54 +00:00
MetaRenamer Use "weak alias" instead of "alias weak" 2014-07-30 22:51:54 +00:00
ObjCARC Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
PartiallyInlineLibCalls PartiallyInlineLibCalls: Check sqrt result type before transforming it. 2014-08-01 23:21:21 +00:00
PhaseOrdering
PruneEH
Reassociate Reassociate x + -0.1234 * y into x - 0.1234 * y 2014-08-21 10:45:30 +00:00
Reg2Mem
SampleProfile Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
Scalarizer Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
ScalarRepl Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
SCCP SCCP: update for cmpxchg returning { iN, i1 } now. 2014-06-13 14:54:09 +00:00
SeparateConstOffsetFromGEP/NVPTX Partially revert r210444 due to performance regression 2014-07-16 23:25:00 +00:00
SimplifyCFG Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
Sink Sink: Don't sink static allocas from the entry block 2014-03-21 15:51:51 +00:00
SLPVectorizer Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
SROA SROA: Don't insert instructions before a PHI 2014-09-01 21:20:14 +00:00
StripSymbols Move the complex address expression out of DIVariable and into an extra 2014-10-01 18:55:02 +00:00
StructurizeCFG
TailCallElim We may visit a call that uses an alloca multiple times in callUsesLocalStack, sometimes with IsNocapture true and sometimes with IsNocapture false. We accidentally skipped work we needed to do in the IsNocapture=false case if we were called with IsNocapture=true the first time. Fixes PR20405! 2014-07-23 06:24:49 +00:00
TailDup Reduce verbiage of lit.local.cfg files 2014-06-09 22:42:55 +00:00
Util utils: Fix segfault in flattencfg 2014-08-13 20:31:53 +00:00