File: dag-large-offset.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (47 lines) | stat: -rw-r--r-- 1,656 bytes parent folder | download | duplicates (6)
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc < %s -mtriple=i386 --frame-pointer=all | FileCheck %s

; ISel will try to fold pointer arithmetic into the address displacement. However, we don't
; want to do that if the offset is very close to the expressible limit because the final frame
; layout may push it over/under the limit.

define i32 @foo(i1 %b) #0 {
; CHECK-LABEL: foo:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    pushl %ebp
; CHECK-NEXT:    .cfi_def_cfa_offset 8
; CHECK-NEXT:    .cfi_offset %ebp, -8
; CHECK-NEXT:    movl %esp, %ebp
; CHECK-NEXT:    .cfi_def_cfa_register %ebp
; CHECK-NEXT:    subl $8, %esp
; CHECK-NEXT:    movl __stack_chk_guard, %eax
; CHECK-NEXT:    movl %eax, -4(%ebp)
; CHECK-NEXT:    testb $1, 8(%ebp)
; CHECK-NEXT:    jne .LBB0_1
; CHECK-NEXT:  # %bb.2: # %entry
; CHECK-NEXT:    xorl %eax, %eax
; CHECK-NEXT:    jmp .LBB0_3
; CHECK-NEXT:  .LBB0_1:
; CHECK-NEXT:    movl $-2147483647, %eax # imm = 0x80000001
; CHECK-NEXT:    leal -5(%ebp,%eax), %eax
; CHECK-NEXT:  .LBB0_3: # %entry
; CHECK-NEXT:    movl __stack_chk_guard, %ecx
; CHECK-NEXT:    cmpl -4(%ebp), %ecx
; CHECK-NEXT:    jne .LBB0_5
; CHECK-NEXT:  # %bb.4: # %entry
; CHECK-NEXT:    addl $8, %esp
; CHECK-NEXT:    popl %ebp
; CHECK-NEXT:    .cfi_def_cfa %esp, 4
; CHECK-NEXT:    retl
; CHECK-NEXT:  .LBB0_5: # %entry
; CHECK-NEXT:    .cfi_def_cfa %ebp, 8
; CHECK-NEXT:    calll __stack_chk_fail
entry:
  %a = alloca i8, align 1
  %0 = ptrtoint ptr %a to i32
  %sub = add i32 %0, -2147483647
  %retval.0 = select i1 %b, i32 %sub, i32 0
  ret i32 %retval.0
}

attributes #0 = { sspreq }