diff options
| author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2015-05-14 18:01:48 +0000 |
|---|---|---|
| committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2015-05-14 18:01:48 +0000 |
| commit | 2905999c22a0b0b21499374ee6e07a20d0f14a27 (patch) | |
| tree | 8b185f244b5e54315d91586ea76665c60f4e17db /clang/lib/Sema/CodeCompleteConsumer.cpp | |
| parent | 42e1e66e55bd297a2d16d0ff5f476f79ad3f08f6 (diff) | |
| download | bcm5719-llvm-2905999c22a0b0b21499374ee6e07a20d0f14a27.tar.gz bcm5719-llvm-2905999c22a0b0b21499374ee6e07a20d0f14a27.zip | |
[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
Diffstat (limited to 'clang/lib/Sema/CodeCompleteConsumer.cpp')
0 files changed, 0 insertions, 0 deletions

