File: fold-remove-li.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 (40 lines) | stat: -rw-r--r-- 1,558 bytes parent folder | download | duplicates (9)
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
; NOTE: This test verifies that a redundant load immediate of zero is folded
; NOTE: from its use in an isel and deleted as it is no longer in use.
; RUN:  llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu \
; RUN:      -ppc-asm-full-reg-names -verify-machineinstrs < %s | FileCheck %s
; RUN:  llc -mcpu=pwr9 -mtriple=powerpc64-unknown-linux-gnu \
; RUN:      -ppc-asm-full-reg-names -verify-machineinstrs < %s | FileCheck %s

%0 = type { i32, i16 }

@val = common dso_local local_unnamed_addr global %0* null, align 8

define dso_local signext i32 @redunLoadImm(%0* %arg) {
; CHECK-LABEL: redunLoadImm:
; verify that the load immediate has been folded into the isel and deleted
; CHECK-NOT:   li r[[REG1:[0-9]+]], 0
; CHECK:       iseleq r[[REG2:[0-9]+]], 0, r[[REG3:[0-9]+]]

bb:
  %tmp = icmp eq %0* %arg, null
  br i1 %tmp, label %bb9, label %bb1

bb1:                                              ; preds = %bb
  %tmp2 = getelementptr inbounds %0, %0* %arg, i64 0, i32 1
  br label %bb3

bb3:                                              ; preds = %bb3, %bb1
  %tmp4 = load i16, i16* %tmp2, align 4
  %tmp5 = sext i16 %tmp4 to i64
  %tmp6 = getelementptr inbounds %0, %0* %arg, i64 %tmp5
  %tmp7 = icmp eq i16 %tmp4, 0
  %tmp8 = select i1 %tmp7, %0* null, %0* %tmp6
  store %0* %tmp8, %0** @val, align 8
  br label %bb3

bb9:                                              ; preds = %bb
  %tmp10 = load %0*, %0** @val, align 8
  %tmp11 = getelementptr inbounds %0, %0* %tmp10, i64 0, i32 0
  %tmp12 = load i32, i32* %tmp11, align 4
  ret i32 %tmp12
}