File: memset-pr52104.ll

package info (click to toggle)
llvm-toolchain-16 1%3A16.0.6-15~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,634,792 kB
  • sloc: cpp: 6,179,261; ansic: 1,216,205; asm: 741,319; python: 196,614; objc: 75,325; f90: 49,640; lisp: 32,396; pascal: 12,286; sh: 9,394; perl: 7,442; ml: 5,494; awk: 3,523; makefile: 2,723; javascript: 1,206; xml: 886; fortran: 581; cs: 573
file content (43 lines) | stat: -rw-r--r-- 1,921 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=loop-idiom < %s -S | FileCheck %s

define void @f(ptr nocapture nonnull align 4 dereferenceable(20) %0, i32 %1) local_unnamed_addr #0 align 32 {
; CHECK-LABEL: @f(
; CHECK-NEXT:    [[TMP3:%.*]] = trunc i32 [[TMP1:%.*]] to i2
; CHECK-NEXT:    [[TMP4:%.*]] = zext i2 [[TMP3]] to i64
; CHECK-NEXT:    [[TMP5:%.*]] = shl nuw nsw i64 [[TMP4]], 2
; CHECK-NEXT:    [[UGLYGEP:%.*]] = getelementptr i8, ptr [[TMP0:%.*]], i64 [[TMP5]]
; CHECK-NEXT:    [[TMP6:%.*]] = sub i2 -1, [[TMP3]]
; CHECK-NEXT:    [[TMP7:%.*]] = zext i2 [[TMP6]] to i64
; CHECK-NEXT:    [[TMP8:%.*]] = shl nuw nsw i64 [[TMP7]], 2
; CHECK-NEXT:    [[TMP9:%.*]] = add nuw nsw i64 [[TMP8]], 4
; CHECK-NEXT:    call void @llvm.memset.p0.i64(ptr align 4 [[UGLYGEP]], i8 0, i64 [[TMP9]], i1 false)
; CHECK-NEXT:    br label [[TMP10:%.*]]
; CHECK:       10:
; CHECK-NEXT:    [[TMP11:%.*]] = phi i32 [ [[TMP15:%.*]], [[TMP10]] ], [ [[TMP1]], [[TMP2:%.*]] ]
; CHECK-NEXT:    [[TMP12:%.*]] = and i32 [[TMP11]], 3
; CHECK-NEXT:    [[TMP13:%.*]] = zext i32 [[TMP12]] to i64
; CHECK-NEXT:    [[TMP14:%.*]] = getelementptr inbounds i32, ptr [[TMP0]], i64 [[TMP13]]
; CHECK-NEXT:    [[TMP15]] = add nsw i32 [[TMP11]], 1
; CHECK-NEXT:    [[TMP16:%.*]] = and i32 [[TMP15]], 3
; CHECK-NEXT:    [[TMP17:%.*]] = icmp eq i32 [[TMP16]], 0
; CHECK-NEXT:    br i1 [[TMP17]], label [[TMP18:%.*]], label [[TMP10]]
; CHECK:       18:
; CHECK-NEXT:    ret void
;
  br label %3

3:                                                ; preds = %3, %1
  %4 = phi i32 [ %8, %3 ], [ %1, %2 ]
  %5 = and i32 %4, 3
  %6 = zext i32 %5 to i64
  %7 = getelementptr inbounds i32, ptr %0, i64 %6
  store i32 0, ptr %7, align 4
  %8 = add nsw i32 %4, 1
  %9 = and i32 %8, 3
  %10 = icmp eq i32 %9, 0
  br i1 %10, label %11, label %3

11:                                               ; preds = %4
  ret void
}