File: PR6627.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 (92 lines) | stat: -rw-r--r-- 3,245 bytes parent folder | download | duplicates (12)
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
83
84
85
86
87
88
89
90
91
92
; RUN: opt -O3 -S < %s | FileCheck %s
; XFAIL: *

declare i32 @doo(...)

; PR6627 - This whole nasty sequence should be flattened down to a single
; 32-bit comparison.
define void @test2(ptr %arrayidx) nounwind ssp {
entry:
  %x1 = load i32, ptr %arrayidx, align 4
  %tmp = trunc i32 %x1 to i8
  %conv = zext i8 %tmp to i32
  %cmp = icmp eq i32 %conv, 127
  br i1 %cmp, label %land.lhs.true, label %if.end

land.lhs.true:                                    ; preds = %entry
  %arrayidx4 = getelementptr inbounds i8, ptr %arrayidx, i64 1
  %tmp5 = load i8, ptr %arrayidx4, align 1
  %conv6 = zext i8 %tmp5 to i32
  %cmp7 = icmp eq i32 %conv6, 69
  br i1 %cmp7, label %land.lhs.true9, label %if.end

land.lhs.true9:                                   ; preds = %land.lhs.true
  %arrayidx12 = getelementptr inbounds i8, ptr %arrayidx, i64 2
  %tmp13 = load i8, ptr %arrayidx12, align 1
  %conv14 = zext i8 %tmp13 to i32
  %cmp15 = icmp eq i32 %conv14, 76
  br i1 %cmp15, label %land.lhs.true17, label %if.end

land.lhs.true17:                                  ; preds = %land.lhs.true9
  %arrayidx20 = getelementptr inbounds i8, ptr %arrayidx, i64 3
  %tmp21 = load i8, ptr %arrayidx20, align 1
  %conv22 = zext i8 %tmp21 to i32
  %cmp23 = icmp eq i32 %conv22, 70
  br i1 %cmp23, label %if.then, label %if.end

if.then:                                          ; preds = %land.lhs.true17
  %call25 = call i32 (...) @doo()
  br label %if.end

if.end:
  ret void

; CHECK-LABEL: @test2(
; CHECK: %x1 = load i32, ptr %arrayidx, align 4
; CHECK-NEXT: icmp eq i32 %x1, 1179403647
; CHECK-NEXT: br i1 {{.*}}, label %if.then, label %if.end 
}

; PR6627 - This should all be flattened down to one compare.  This is the same
; as test2, except that the initial load is done as an i8 instead of i32, thus
; requiring widening.
define void @test2a(ptr %arrayidx) nounwind ssp {
entry:
  %x1 = load i8, ptr %arrayidx, align 4
  %conv = zext i8 %x1 to i32
  %cmp = icmp eq i32 %conv, 127
  br i1 %cmp, label %land.lhs.true, label %if.end

land.lhs.true:                                    ; preds = %entry
  %arrayidx4 = getelementptr inbounds i8, ptr %arrayidx, i64 1
  %tmp5 = load i8, ptr %arrayidx4, align 1
  %conv6 = zext i8 %tmp5 to i32
  %cmp7 = icmp eq i32 %conv6, 69
  br i1 %cmp7, label %land.lhs.true9, label %if.end

land.lhs.true9:                                   ; preds = %land.lhs.true
  %arrayidx12 = getelementptr inbounds i8, ptr %arrayidx, i64 2
  %tmp13 = load i8, ptr %arrayidx12, align 1
  %conv14 = zext i8 %tmp13 to i32
  %cmp15 = icmp eq i32 %conv14, 76
  br i1 %cmp15, label %land.lhs.true17, label %if.end

land.lhs.true17:                                  ; preds = %land.lhs.true9
  %arrayidx20 = getelementptr inbounds i8, ptr %arrayidx, i64 3
  %tmp21 = load i8, ptr %arrayidx20, align 1
  %conv22 = zext i8 %tmp21 to i32
  %cmp23 = icmp eq i32 %conv22, 70
  br i1 %cmp23, label %if.then, label %if.end

if.then:                                          ; preds = %land.lhs.true17
  %call25 = call i32 (...) @doo()
  br label %if.end

if.end:
  ret void

; CHECK-LABEL: @test2a(
; CHECK: %x1 = load i32, ptr {{.*}}, align 4
; CHECK-NEXT: icmp eq i32 %x1, 1179403647
; CHECK-NEXT: br i1 {{.*}}, label %if.then, label %if.end 
}