<div dir="auto"><div><br><div class="gmail_extra">Forgot to reply to all<br><div class="gmail_quote"><br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Hi Eli<div class="quoted-text"><br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="m_-148379498413252890quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div text="#000000" bgcolor="#FFFFFF"><div class="m_-148379498413252890quoted-text"><blockquote type="cite"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    struct S {</div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">      unsigned
          int a : 8;</div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">      unsigned
          int b : 8;</div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">      unsigned
          int c : 8;</div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">      unsigned
          int d : 8;</div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">      unsigned
          int e;</div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    }</div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">We want to read
          S->b for example. The size of struct S is 64 bits, and
          seems LLVM treats it as i64.</div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Below is the IR
          corresponding to S->b, IIRC. </div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br>
        </div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    %0 = load
          i64, *i64 ptr, align 4;</div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    %1 = %0
          lshr 8;</div>
        <div class="gmail_default" style="font-family:arial,helvetica,sans-serif">    %2 = %1 and
          255;</div>
      </div>
    </blockquote>
    <br></div>
    This looks fine.</div></blockquote></div></div></div></div><div dir="auto"><br></div><div dir="auto">Why can't we expect InstCombine to simplify this to an 8 bit load, assuming each of %0 and %1 has only one use ?</div><div dir="auto"><br></div><div dir="auto">Thanks</div><font color="#888888"><div dir="auto">Ehsan</div><div dir="auto"><br></div><div dir="auto"></div><div dir="auto"><div class="gmail_extra"><br></div></div></font></div>
</blockquote></div><br></div></div></div>