File: ctpop-multiple-users-crash.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 (34 lines) | stat: -rw-r--r-- 1,303 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
; RUN: opt -passes=loop-idiom -S < %s | FileCheck %s

target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-ios8.0.0"

; When we replace the precondition with a ctpop, we need to ensure
; that only the first branch reads the ctpop.  The store prior
; to that should continue to read from the original compare.

; CHECK: %tobool.5 = icmp ne i32 %num, 0
; CHECK: store i1 %tobool.5, ptr %ptr

define internal fastcc i32 @num_bits_set(i32 %num, ptr %ptr) #1 {
entry:
  %tobool.5 = icmp ne i32 %num, 0
  store i1 %tobool.5, ptr %ptr
  br i1 %tobool.5, label %for.body.lr.ph, label %for.end

for.body.lr.ph:                                   ; preds = %entry
  br label %for.body

for.body:                                         ; preds = %for.body.lr.ph, %for.body
  %count.07 = phi i32 [ 0, %for.body.lr.ph ], [ %inc, %for.body ]
  %num.addr.06 = phi i32 [ %num, %for.body.lr.ph ], [ %and, %for.body ]
  %sub = add i32 %num.addr.06, -1
  %and = and i32 %sub, %num.addr.06
  %inc = add nsw i32 %count.07, 1
  %tobool = icmp ne i32 %and, 0
  br i1 %tobool, label %for.body, label %for.end

for.end:                                          ; preds = %for.cond.for.end_crit_edge, %entry
  %count.0.lcssa = phi i32 [ %inc, %for.body ], [ 0, %entry ]
  ret i32 %count.0.lcssa
}