File: strto-1.ll

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (82 lines) | stat: -rw-r--r-- 2,729 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
; Test that the strto* library call simplifiers works correctly.
;
; RUN: opt < %s -passes='function(instcombine),inferattrs' -S | FileCheck %s

target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"

declare i32 @strtol(ptr %s, ptr %endptr, i32 %base)
; CHECK: declare i32 @strtol(ptr readonly, ptr nocapture, i32)

declare double @strtod(ptr %s, ptr %endptr)
; CHECK: declare double @strtod(ptr readonly, ptr nocapture)

declare float @strtof(ptr %s, ptr %endptr)
; CHECK: declare float @strtof(ptr readonly, ptr nocapture)

declare i64 @strtoul(ptr %s, ptr %endptr, i32 %base)
; CHECK: declare i64 @strtoul(ptr readonly, ptr nocapture, i32)

declare i64 @strtoll(ptr %s, ptr %endptr, i32 %base)
; CHECK: declare i64 @strtoll(ptr readonly, ptr nocapture, i32)

declare double @strtold(ptr %s, ptr %endptr)
; CHECK: declare double @strtold(ptr readonly, ptr nocapture)

declare i64 @strtoull(ptr %s, ptr %endptr, i32 %base)
; CHECK: declare i64 @strtoull(ptr readonly, ptr nocapture, i32)

define void @test_simplify1(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify1(
  call i32 @strtol(ptr %x, ptr null, i32 10)
; CHECK-NEXT: call i32 @strtol(ptr nocapture %x, ptr null, i32 10)
  ret void
}

define void @test_simplify2(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify2(
  call double @strtod(ptr %x, ptr null)
; CHECK-NEXT: call double @strtod(ptr nocapture %x, ptr null)
  ret void
}

define void @test_simplify3(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify3(
  call float @strtof(ptr %x, ptr null)
; CHECK-NEXT: call float @strtof(ptr nocapture %x, ptr null)
  ret void
}

define void @test_simplify4(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify4(
  call i64 @strtoul(ptr %x, ptr null, i32 10)
; CHECK-NEXT: call i64 @strtoul(ptr nocapture %x, ptr null, i32 10)
  ret void
}

define void @test_simplify5(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify5(
  call i64 @strtoll(ptr %x, ptr null, i32 10)
; CHECK-NEXT: call i64 @strtoll(ptr nocapture %x, ptr null, i32 10)
  ret void
}

define void @test_simplify6(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify6(
  call double @strtold(ptr %x, ptr null)
; CHECK-NEXT: call double @strtold(ptr nocapture %x, ptr null)
  ret void
}

define void @test_simplify7(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_simplify7(
  call i64 @strtoull(ptr %x, ptr null, i32 10)
; CHECK-NEXT: call i64 @strtoull(ptr nocapture %x, ptr null, i32 10)
  ret void
}

define void @test_no_simplify1(ptr %x, ptr %endptr) {
; CHECK-LABEL: @test_no_simplify1(
  call i32 @strtol(ptr %x, ptr %endptr, i32 10)
; CHECK-NEXT: call i32 @strtol(ptr %x, ptr %endptr, i32 10)
  ret void
}