Skip to content
Unverified Commit ad506760 authored by Victor Mustya's avatar Victor Mustya Committed by GitHub
Browse files

[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.
parent 142f270c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment