llvm-mirror/test/Transforms/ConstProp
Andrea Di Biagio 67c82df819 [ConstantFolding] Fix wrong folding of intrinsic 'convert.from.fp16'.
Function 'ConstantFoldScalarCall' (in ConstantFolding.cpp) works under the
wrong assumption that a call to 'convert.from.fp16' returns a value of
type 'float'.
However, intrinsic 'convert.from.fp16' can be overloaded; for example, we
can call 'convert.from.fp16.f64' to convert from half to double; etc.

Before this patch, the following example would have triggered an assertion
failure in opt (with -constprop):

```
define double @foo() {
entry:
  %0 = call double @llvm.convert.from.fp16.f64(i16 0)
  ret double %0
}
```

This patch fixes the problem in ConstantFolding.cpp. When folding a call to
convert.from.fp16, we perform a different kind of conversion based on the call
return type.

Added test 'Transform/ConstProp/convert-from-fp16.ll'.

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

llvm-svn: 237377
2015-05-14 18:01:48 +00:00
..
2002-05-03-DivideByZeroException.ll
2002-05-03-NotOperator.ll
2002-09-03-SetCC-Bools.ll
2003-05-12-DivideError.ll
2005-01-28-SetCCGEP.ll [opaque pointer type] Add textual IR support for explicit type parameter to gep operator 2015-03-13 18:20:45 +00:00
2006-11-30-vector-cast.ll
2006-12-01-bool-casts.ll
2006-12-01-TruncBoolBug.ll
2007-02-05-BitCast.ll
2007-02-23-sdiv.ll
2007-11-23-cttz.ll
2008-07-07-VectorCompare.ll
2009-06-20-constexpr-zero-lhs.ll
2009-09-01-GEP-Crash.ll [opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction 2015-02-27 19:29:02 +00:00
basictest.ll
bitcast.ll
bswap.ll
calls.ll
constant-expr.ll
convert-from-fp16.ll [ConstantFolding] Fix wrong folding of intrinsic 'convert.from.fp16'. 2015-05-14 18:01:48 +00:00
div-zero.ll [opaque pointer type] Add textual IR support for explicit type parameter to gep operator 2015-03-13 18:20:45 +00:00
extractvalue.ll
float-to-ptr-cast.ll
InsertElement.ll Constfold insertelement to undef when index is out-of-bounds 2015-04-27 09:30:49 +00:00
insertvalue.ll Avoid conversion to float when creating ConstantDataArray/ConstantDataVector. 2015-02-19 16:08:20 +00:00
loads.ll [opaque pointer type] Add textual IR support for explicit type parameter to gep operator 2015-03-13 18:20:45 +00:00
logicaltest.ll
overflow-ops.ll
phi.ll
remtest.ll
shift.ll ConstantFold: Fix big shift constant folding 2015-03-13 16:39:46 +00:00
trunc_vec.ll