File: exit_value_test2.ll

package info (click to toggle)
llvm-toolchain-3.7 1%3A3.7.1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 345,556 kB
  • ctags: 362,199
  • sloc: cpp: 2,156,381; ansic: 458,339; objc: 91,547; python: 89,988; asm: 86,305; sh: 21,479; makefile: 6,853; perl: 5,601; ml: 5,458; pascal: 3,933; lisp: 2,429; xml: 686; cs: 239; php: 202; csh: 117
file content (52 lines) | stat: -rw-r--r-- 2,054 bytes parent folder | download | duplicates (7)
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
44
45
46
47
48
49
50
51
52
; PR23538
; RUN: opt < %s -indvars -loop-deletion -S | FileCheck %s

; Check IndVarSimplify should not replace exit value because or else
; udiv will be introduced by expand and the cost will be high.
;
; CHECK-LABEL: @_Z3fooPKcjj(
; CHECK-NOT: udiv

declare void @_Z3mixRjj(i32* dereferenceable(4), i32)
declare void @llvm.lifetime.start(i64, i8* nocapture)
declare void @llvm.lifetime.end(i64, i8* nocapture)

define i32 @_Z3fooPKcjj(i8* nocapture readonly %s, i32 %len, i32 %c) {
entry:
  %a = alloca i32, align 4
  %tmp = bitcast i32* %a to i8*
  call void @llvm.lifetime.start(i64 4, i8* %tmp)
  store i32 -1640531527, i32* %a, align 4
  %cmp8 = icmp ugt i32 %len, 11
  br i1 %cmp8, label %while.body.lr.ph, label %while.end

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

while.body:                                       ; preds = %while.body, %while.body.lr.ph
  %keylen.010 = phi i32 [ %len, %while.body.lr.ph ], [ %sub, %while.body ]
  %s.addr.09 = phi i8* [ %s, %while.body.lr.ph ], [ %add.ptr, %while.body ]
  %tmp1 = bitcast i8* %s.addr.09 to i32*
  %tmp2 = load i32, i32* %tmp1, align 4
  %shl.i = shl i32 %tmp2, 1
  %and.i = and i32 %shl.i, 16843008
  %tmp3 = load i32, i32* %a, align 4
  %sub.i = add i32 %tmp3, %tmp2
  %add = sub i32 %sub.i, %and.i
  store i32 %add, i32* %a, align 4
  %add.ptr = getelementptr inbounds i8, i8* %s.addr.09, i64 12
  %sub = add i32 %keylen.010, -12
  %cmp = icmp ugt i32 %sub, 11
  br i1 %cmp, label %while.body, label %while.cond.while.end_crit_edge

while.cond.while.end_crit_edge:                   ; preds = %while.body
  %sub.lcssa = phi i32 [ %sub, %while.body ]
  br label %while.end

while.end:                                        ; preds = %while.cond.while.end_crit_edge, %entry
  %keylen.0.lcssa = phi i32 [ %sub.lcssa, %while.cond.while.end_crit_edge ], [ %len, %entry ]
  call void @_Z3mixRjj(i32* dereferenceable(4) %a, i32 %keylen.0.lcssa)
  %tmp4 = load i32, i32* %a, align 4
  call void @llvm.lifetime.end(i64 4, i8* %tmp)
  ret i32 %tmp4
}