<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:florian_hahn@apple.com" title="Florian Hahn <florian_hahn@apple.com>"> <span class="fn">Florian Hahn</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Should recognize memset loop with a global induction variable"
   href="https://bugs.llvm.org/show_bug.cgi?id=14753">bug 14753</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>---
           </td>
           <td>FIXED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>CONFIRMED
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>florian_hahn@apple.com
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Should recognize memset loop with a global induction variable"
   href="https://bugs.llvm.org/show_bug.cgi?id=14753#c13">Comment # 13</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Should recognize memset loop with a global induction variable"
   href="https://bugs.llvm.org/show_bug.cgi?id=14753">bug 14753</a>
              from <span class="vcard"><a class="email" href="mailto:florian_hahn@apple.com" title="Florian Hahn <florian_hahn@apple.com>"> <span class="fn">Florian Hahn</span></a>
</span></b>
        <pre>This is optimized to a memset now <a href="https://godbolt.org/z/aTrfqc">https://godbolt.org/z/aTrfqc</a>



@gi = dso_local local_unnamed_addr global i32 0, align 4

define dso_local void @_Z4foo2iPf(i32 %0, float* nocapture %1)
local_unnamed_addr #0 {
  store i32 0, i32* @gi, align 4, !tbaa !2
  %3 = icmp sgt i32 %0, 0
  br i1 %3, label %4, label %8

4:                                                ; preds = %2
  %5 = bitcast float* %1 to i8*
  %6 = zext i32 %0 to i64
  %7 = shl nuw nsw i64 %6, 2
  call void @llvm.memset.p0i8.i64(i8* align 4 %5, i8 0, i64 %7, i1 false)
  store i32 %0, i32* @gi, align 4, !tbaa !2
  br label %8

8:                                                ; preds = %4, %2
  ret void
}

declare void @llvm.memset.p0i8.i64(i8* nocapture writeonly, i8, i64, i1 immarg)
#1

attributes #0 = { nofree norecurse nounwind uwtable mustprogress
"disable-tail-calls"="false" "frame-pointer"="none"
"less-precise-fpmad"="false" "min-legal-vector-width"="0"
"no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false"
"no-signed-zeros-fp-math"="false" "no-trapping-math"="true"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic"
"unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { argmemonly nofree nosync nounwind willreturn writeonly }</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>