[PATCH] D127854: [InstCombine] Use known bits to determine exact int->fp cast
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 16 07:42:16 PDT 2022
spatel added inline comments.
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp:1945
auto *FPCast = cast<CastInst>(Src);
- if (isKnownExactCastIntToFP(*FPCast))
+ if (isKnownExactCastIntToFP(*FPCast, *this))
return CastInst::Create(FPCast->getOpcode(), FPCast->getOperand(0), Ty);
----------------
We should have at least one test providing coverage for this path (and fpext too?).
IIUC, this patch will improve a case like this:
```
define half @masked_int_to_fp_trunc(i32 %A) {
%m = and i32 %A, 16777215
%B = sitofp i32 %m to float
%C = fptrunc float %B to half
ret half %C
}
```
But we don't actually need a mask:
https://alive2.llvm.org/ce/z/iaEX2i
...so the fold conditions still aren't quite right.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D127854/new/
https://reviews.llvm.org/D127854
More information about the llvm-commits
mailing list