File: memset-pr52104.ll

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (43 lines) | stat: -rw-r--r-- 1,937 bytes parent folder | download | duplicates (4)
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 -basic-aa -loop-idiom < %s -S | FileCheck %s

define void @f(i32* 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:    [[SCEVGEP:%.*]] = getelementptr i32, i32* [[TMP0:%.*]], i64 [[TMP4]]
; CHECK-NEXT:    [[SCEVGEP1:%.*]] = bitcast i32* [[SCEVGEP]] to i8*
; CHECK-NEXT:    [[TMP5:%.*]] = sub i2 -1, [[TMP3]]
; CHECK-NEXT:    [[TMP6:%.*]] = zext i2 [[TMP5]] to i64
; CHECK-NEXT:    [[TMP7:%.*]] = shl nuw nsw i64 [[TMP6]], 2
; CHECK-NEXT:    [[TMP8:%.*]] = add nuw nsw i64 [[TMP7]], 4
; CHECK-NEXT:    call void @llvm.memset.p0i8.i64(i8* align 4 [[SCEVGEP1]], i8 0, i64 [[TMP8]], i1 false)
; CHECK-NEXT:    br label [[TMP9:%.*]]
; CHECK:       9:
; CHECK-NEXT:    [[TMP10:%.*]] = phi i32 [ [[TMP14:%.*]], [[TMP9]] ], [ [[TMP1]], [[TMP2:%.*]] ]
; CHECK-NEXT:    [[TMP11:%.*]] = and i32 [[TMP10]], 3
; CHECK-NEXT:    [[TMP12:%.*]] = zext i32 [[TMP11]] to i64
; CHECK-NEXT:    [[TMP13:%.*]] = getelementptr inbounds i32, i32* [[TMP0]], i64 [[TMP12]]
; CHECK-NEXT:    [[TMP14]] = add nsw i32 [[TMP10]], 1
; CHECK-NEXT:    [[TMP15:%.*]] = and i32 [[TMP14]], 3
; CHECK-NEXT:    [[TMP16:%.*]] = icmp eq i32 [[TMP15]], 0
; CHECK-NEXT:    br i1 [[TMP16]], label [[TMP17:%.*]], label [[TMP9]]
; CHECK:       17:
; 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, i32* %0, i64 %6
  store i32 0, i32* %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
}