[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.
Loading
Please sign in to comment