<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:lebedev.ri@gmail.com" title="Roman Lebedev <lebedev.ri@gmail.com>"> <span class="fn">Roman Lebedev</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - InstCombine: shift amount reassociation when doing bit test"
   href="https://bugs.llvm.org/show_bug.cgi?id=42399">bug 42399</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>FIXED
           </td>
           <td>---
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - InstCombine: shift amount reassociation when doing bit test"
   href="https://bugs.llvm.org/show_bug.cgi?id=42399#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - InstCombine: shift amount reassociation when doing bit test"
   href="https://bugs.llvm.org/show_bug.cgi?id=42399">bug 42399</a>
              from <span class="vcard"><a class="email" href="mailto:lebedev.ri@gmail.com" title="Roman Lebedev <lebedev.ri@gmail.com>"> <span class="fn">Roman Lebedev</span></a>
</span></b>
        <pre>... and it wasn't enough.

; Function Attrs: norecurse nounwind readnone
define i1 @test(i64 %storage, i32 %nbits) local_unnamed_addr #0 {
bb:
  %skipnbits = sub nsw i32 64, %nbits
  %skipnbitswide = zext i32 %skipnbits to i64
  %datawide = lshr i64 %storage, %skipnbitswide
  %data = trunc i64 %datawide to i32
  %nbitsminusone = add nsw i32 %nbits, -1
  %bitmask = shl i32 1, %nbitsminusone
  %bitmasked = and i32 %bitmask, %data
  %isbitunset = icmp eq i32 %bitmasked, 0
  ret i1 %isbitunset
}

attributes #0 = { norecurse nounwind readnone }

Name: PR42399
  %skipnbits = sub nsw i32 64, %nbits
  %skipnbitswide = zext i32 %skipnbits to i64
  %datawide = lshr i64 %storage, %skipnbitswide
  %data = trunc i64 %datawide to i32
  %nbitsminusone = add nsw i32 %nbits, -1
  %bitmask = shl i32 1, %nbitsminusone
  %bitmasked = and i32 %bitmask, %data
  %isbitunset = icmp eq i32 %bitmasked, 0
=>
  %isbitunset = icmp sgt i64 %storage, -1

<a href="https://rise4fun.com/Alive/hUu">https://rise4fun.com/Alive/hUu</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>