File: pre-coalesce.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 (51 lines) | stat: -rw-r--r-- 1,774 bytes parent folder | download | duplicates (14)
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
; RUN: llc -regalloc=greedy -mtriple=x86_64-unknown-linux-gnu  < %s -o - | FileCheck %s
;
; The test is to check no redundent mov as follows will be generated in %while.body loop.
;  .LBB0_2:
;    movsbl	%cl, %ecx
;    movl	%edx, %eax   ==> This movl can be promoted outside of loop.
;    shll	$5, %eax
;    ...
;    movl	%eax, %edx
;    jne     .LBB0_2
;
; CHECK-LABEL: foo:
; CHECK: [[L0:.LBB0_[0-9]+]]: # %while.body
; CHECK: movl %[[REGA:.*]], %[[REGB:.*]]
; CHECK-NOT: movl %[[REGB]], %[[REGA]]
; CHECK: jne [[L0]]
;
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

@b = common local_unnamed_addr global i8* null, align 8
@a = common local_unnamed_addr global i32 0, align 4

define i32 @foo() local_unnamed_addr {
entry:
  %t0 = load i8*, i8** @b, align 8
  %t1 = load i8, i8* %t0, align 1
  %cmp4 = icmp eq i8 %t1, 0
  %t2 = load i32, i32* @a, align 4
  br i1 %cmp4, label %while.end, label %while.body.preheader

while.body.preheader:                             ; preds = %entry
  br label %while.body

while.body:                                       ; preds = %while.body.preheader, %while.body
  %t3 = phi i32 [ %add3, %while.body ], [ %t2, %while.body.preheader ]
  %t4 = phi i8 [ %t5, %while.body ], [ %t1, %while.body.preheader ]
  %conv = sext i8 %t4 to i32
  %add = mul i32 %t3, 33
  %add3 = add nsw i32 %add, %conv
  store i32 %add3, i32* @a, align 4
  %t5 = load i8, i8* %t0, align 1
  %cmp = icmp eq i8 %t5, 0
  br i1 %cmp, label %while.end.loopexit, label %while.body

while.end.loopexit:                               ; preds = %while.body
  br label %while.end

while.end:                                        ; preds = %while.end.loopexit, %entry
  %.lcssa = phi i32 [ %t2, %entry ], [ %add3, %while.end.loopexit ]
  ret i32 %.lcssa
}