[llvm] [Transforms] Resolve FIXME: Pick the smallest legal type that fits (PR #79158)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 26 10:21:02 PST 2024
================
@@ -382,9 +382,18 @@ bool Float2IntPass::validateAndTransform() {
continue;
}
- // OK, R is known to be representable. Now pick a type for it.
- // FIXME: Pick the smallest legal type that will fit.
- Type *Ty = (MinBW > 32) ? Type::getInt64Ty(*Ctx) : Type::getInt32Ty(*Ctx);
+ // OK, R is known to be representable.
+ // Pick the smallest legal type that will fit.
+ Type *Ty;
+ if (MinBW <= 8) {
+ Ty = Type::getInt8Ty(*Ctx);
+ } else if (MinBW <= 16) {
+ Ty = Type::getInt16Ty(*Ctx);
+ } else if (MinBW <= 32) {
+ Ty = Type::getInt32Ty(*Ctx);
+ } else {
+ Ty = Type::getInt64Ty(*Ctx);
+ }
----------------
AtariDreams wrote:
@nikic Fixed!
https://github.com/llvm/llvm-project/pull/79158
More information about the llvm-commits
mailing list