[all-commits] [llvm/llvm-project] 8650f0: [InstCombine] fix miscompile when casting int->FP-...
Sanjay Patel via All-commits
all-commits at lists.llvm.org
Sat May 7 05:51:05 PDT 2022
Author: Sanjay Patel <spatel at rotateright.com>
Date: 2022-05-07 (Sat, 07 May 2022)
[InstCombine] fix miscompile when casting int->FP->int
As shown in https://github.com/llvm/llvm-project/issues/55150 -
the existing fold may be wrong when converting to a signed value.
This is a quick fix to avoid the miscompile.
I added tests/comments for all of the signed/unsigned combinations
at either side of the boundary width, and tried to confirm with Alive2:
There are already some TODO items in the test file that suggest
possible refinements, so the regression with ui->FP->si is probably ok.
It seems unlikely that we'd see these kind of edge cases with
non-byte-width integer types in real code. The potential miscompile
went undetected for several years.
This and 747c6a0c734e fixes #55150.
Differential Revision: https://reviews.llvm.org/D124692
More information about the All-commits