[PATCH] D42424: [InstCombine] Allow common type conversions to i8/i16

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 23 10:05:28 PST 2018


spatel added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstructionCombining.cpp:156-157
+  // extra combine opportunities.
+  if (FromLegal && ToWidth < FromWidth && (ToWidth == 8 || ToWidth == 16))
+    return true;
+
----------------
spatel wrote:
> See Alex Bradbury's comment in the llvm-dev thread about i32 too. Maybe we generalize this for ToLegal as:
>   bool ToLegal = ToWidth == 1 || isPowerOf2_32(ToWidth) || DL.isLegalInteger(ToWidth);
pow2 isn't quite right; nobody wants i2 or i4. :)


https://reviews.llvm.org/D42424





More information about the llvm-commits mailing list