diff options
author | Victor Mustya <victor.mustya@intel.com> | 2024-01-16 14:13:05 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-16 14:13:05 -0800 |
commit | ad50676055cf03fd4fecdda5736c7ac1a940231f (patch) | |
tree | c80cae8d1cb2fa1a96f7934f974f8217e9e82404 /llvm/lib/CodeGen/BasicBlockSections.cpp | |
parent | 142f270c279f2576e4618fc0d1121181c7531fdf (diff) | |
download | llvm-ad50676055cf03fd4fecdda5736c7ac1a940231f.zip llvm-ad50676055cf03fd4fecdda5736c7ac1a940231f.tar.gz llvm-ad50676055cf03fd4fecdda5736c7ac1a940231f.tar.bz2 |
[InstCombine] Only fold bitcast(fptrunc) if destination type matches fptrunc result type. (#77046)
It's not enough to just make sure destination type is floating point,
because the following chain may be incorrectly optimized:
```LLVM
%trunc = fptrunc float %src to bfloat
%cast = bitcast bfloat %trunc to half
```
Before the fix, the instruction sequence mentioned above used to be
translated into single fptrunc instruction as follows:
```LLVM
%trunc = fptrunc float %src to half
```
Such transformation was semantically incorrect.
Diffstat (limited to 'llvm/lib/CodeGen/BasicBlockSections.cpp')
0 files changed, 0 insertions, 0 deletions