[llvm-bugs] [Bug 14753] Should recognize memset loop with a global induction variable

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Dec 23 11:45:50 PST 2020


https://bugs.llvm.org/show_bug.cgi?id=14753

Florian Hahn <florian_hahn at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|CONFIRMED                   |RESOLVED
                 CC|                            |florian_hahn at apple.com

--- Comment #13 from Florian Hahn <florian_hahn at apple.com> ---
This is optimized to a memset now https://godbolt.org/z/aTrfqc



@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 }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201223/b9db9058/attachment.html>


More information about the llvm-bugs mailing list