<div dir="ltr">Hi Sanjay,<br><div><div class="gmail_extra"><br><div class="gmail_quote">2017-01-30 22:22 GMT+01:00 Sanjay Patel <span dir="ltr"><<a href="mailto:spatel@rotateright.com" target="_blank">spatel@rotateright.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">My minimal patch idea is to ease the restriction in ShouldChangeType because i1 is special. I tried the patch below, and it works on the example...and nothing in 'make check' failed. :)<br></div></blockquote><div><br></div><div>Yeah, that would work for me as well, I just wasn't sure about the implications that has. Simply making FoldPHIArgOpIntoPHI act like FoldPHIArgZextsIntoPHI seemed like the safer option to me, but I wanted feedback on it before creating a PR. Do you want to go ahead with that minimal approach and create a PR yourself?<br><br></div><div>Björn<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Index: lib/Transforms/InstCombine/<wbr>InstructionCombining.cpp<br>==============================<wbr>==============================<wbr>=======<br>--- lib/Transforms/InstCombine/<wbr>InstructionCombining.cpp    (revision 293485)<br>+++ lib/Transforms/InstCombine/<wbr>InstructionCombining.cpp    (working copy)<br>@@ -88,12 +88,12 @@<br> <br> /// Return true if it is desirable to convert an integer computation from a<br> /// given bit width to a new bit width.<br>-/// We don't want to convert from a legal to an illegal type for example or from<br>-/// a smaller to a larger illegal type.<br>+/// We don't want to convert from a legal to an illegal type or from a smaller<br>+/// to a larger illegal type. Width of '1' is always treated as a legal type.<br> bool InstCombiner::<wbr>ShouldChangeType(unsigned FromWidth,<br>                              <wbr>       unsigned ToWidth) const {<br>-  bool FromLegal = DL.isLegalInteger(FromWidth);<br>-  bool ToLegal = DL.isLegalInteger(ToWidth);<br>+  bool FromLegal = FromWidth == 1 ? true : DL.isLegalInteger(FromWidth);<br>+  bool ToLegal = ToWidth == 1 ? true : DL.isLegalInteger(ToWidth);<br> <br>   // If this is a legal integer from type, and the result would be an illegal<br>   // type, don't do the transformation.<br>@@ -110,7 +110,7 @@<br> <br> /// Return true if it is desirable to convert a computation from 'From' to 'To'.<br> /// We don't want to convert from a legal to an illegal type for example or from<br>-/// a smaller to a larger illegal type.<br>+/// a smaller to a larger illegal type. i1 is always treated as a legal type.<br> bool InstCombiner::<wbr>ShouldChangeType(Type *From, Type *To) const {<br>   assert(From->isIntegerTy() && To->isIntegerTy());<br></div></blockquote></div></div></div></div>