File: partial-unroll-dead-instructions.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (42 lines) | stat: -rw-r--r-- 1,136 bytes parent folder | download | duplicates (12)
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
; RUN: opt -S < %s -passes=loop-unroll -unroll-allow-partial=1 | FileCheck %s
;
; Bugpointed test that triggered UB while cleaning up dead
; instructions after simplifying indvars

; We just check that some unrolling happened here - the assert we've
; added to ValueHandleBase::operator* would fire if the bug was still
; present.
; CHECK: atomicrmw volatile add ptr
; CHECK: atomicrmw volatile add ptr
; CHECK: atomicrmw volatile add ptr

@global = external global i32, align 4

define void @widget() {
bb:
  br label %bb1

bb1:
  br label %bb2

bb2:
  %tmp = phi i32 [ 0, %bb1 ], [ %tmp34, %bb33 ]
  %tmp3 = phi i32 [ 0, %bb1 ], [ %tmp34, %bb33 ]
  %tmp26 = and i32 %tmp, 1073741823
  %tmp27 = getelementptr inbounds i32, ptr @global, i32 %tmp26
  %tmp28 = atomicrmw volatile add ptr %tmp27, i32 1 monotonic
  %tmp29 = icmp ugt i32 %tmp28, 23
  %tmp30 = shl i32 %tmp, 6
  %tmp31 = add i32 %tmp30, undef
  %tmp32 = add i32 %tmp31, %tmp28
  store i32 undef, ptr undef, align 4
  br label %bb33

bb33:
  %tmp34 = add nuw nsw i32 %tmp3, 1
  %tmp35 = icmp ult i32 %tmp3, 15
  br i1 %tmp35, label %bb2, label %bb36

bb36:
  br label %bb1
}